Assume I have the following structure of a package:
parent/
package/
__init__.py
utils/
__init__.py
foo.py
apps/
__init__.py
bar.py
Now, I want to import the module foo
from the module bar
. What is the correct way to do it? I will welcome comments on the structure of my project :)
So far I only found answers where everything lives in the same directory... I tried something like:
from ..utils import foo
but I get:
Traceback (most recent call last):
File "./bar.py", line 4, in <module>
from ..utils import foo
ValueError: Attempted relative import in non-package