Suppose I have a project set up as follows:
myproject/ setup.py myproject/ __init__.py module1/ __init__.py a.py b.py test/ __init__.py test.py In a.py I have:
from b import Something In test.py I have:
from myproject.module1 import a When I run test.py I get a ImportError because b cannot be found - since test.py is in a different directory.
I know I can fix this in a.py by writing from myproject.module1.b import Something, but this seems far too verbose to do throughout the project.
Is there a better way?
__init__.pyin myproject as well? Is this path in thePYTHONPATH?myprojectthat is the parent ofmodule1is on the PYTHONPATH