[Python] ImportError: No module named 'app'

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on a project with following tree structure:

    Project
    app
    main.py
    svg_to_png.py
    __init__.py
    tests
    __init__.py
    unittests
    basic_test.py
    __init__.py


    I am importing app functions to basic_tests by using

    from app.main import *


    when I execute the basic_test.py, it gives the following error:

    ImportError: No module named 'app'


    Also, while in the top directory of the project, when I type python3 -m app.main, the program executes for a while, then gives the same import error at the following line

    from app.svg_to_png import do_svg2png

    Continue reading...

Compartilhe esta Página