I have a following structure of python modules:
/foo.py
/module
/module/__init__.py
/module/submodule/__init__.py
/module/submodule/bar.py
in foo.py I have the following code:
from module.submodule.bar import *
But as the result I’m getting the following error:
'.../module/bar.py': [Errno 2] No such file or directory
Why python is trying to find the file at /module/bar.py but not module/submodule/bar as I stated in import?
It was an error of PyCharm. If you’re moving your script from one folder to another it saves the old path and working with it, even if you’re changed it in Run config. So recreation of Run config solves the issue.