I use __init__.py in my project with the following structure :
project\
project.py
cfg.py
__init__.py
database\
data.py
__init__.py
test\
test_project.py
__init__.py
All is OK when I need to see database\ modules in project.py with
from database.data import *
But if I need to have some test code inside the test_project.py, how to ‘see’ the database\ modules ?
You have 3 options:
from .. import database.data). I wouldn’t recommend that one.sys.pathin your code.addsitedir()and.pthfiles. Here is how.