My imports dont show any linting errors (flake8), but generate a ModuleNotFoundError when run.
The application can be started from either __main__.py
or bar.py
. Both modules call bar.py
. The application seems to work when __main__
is called, but I get the following error when running bar
:
Traceback (most recent call last):
File "a:/Git/repo/lib/data/bar.py", line 1, in <module>
from src.foo import classA
ModuleNotFoundError: No module named 'src'
Directory structure
repo
└── lib
├── src
│ ├── __init__.py
│ ├── __main__.py
│ └── foo.py
├── data
│ ├── __init__.py
│ └── bar.py
└── __init__.py
main
from foo import classA
foo
class classA:
def dostuff(x):
...
bar
from src.foo import classA