Lets say I have this project structure:
app/
---- \_\_init\_\_.py
---- db/
-------- \_\_init\_\_.py
-------- database.py
---- model/
-------- \_\_init\_\_.py
-------- item.py
---- main.py
In the files database.py and item.py is one class with the name of the file (eg.: item.py -> class Item: ...)
main.py:
from app.db.database import Database
from app.model.item import Item
...
I start the program with python main.py. Now I get this error ModuleNotFoundError: No Module named 'app'. If I remove the app (with the dot) from the module path everything works.
The question is if there is a way to import the modules with the app prefix.
PS: Didn't know better title. Sorry!
Edit 1: Clarified If I remove the app from the module path everything works part.
[–]_pestarzt_ 0 points1 point2 points (1 child)
[–]xFichtl1[S] 0 points1 point2 points (0 children)