I have a project that has this file structure:
f1 f2 __init__.py a.py b.py main.py main.py
from f2 import a ... a.py
import b ... b.py
print('Hello World!') ... When I run main.py, I get an import error from a.py saying "ImportError: No module named 'b'" but when I run a.py, it functions as expected.
f2 was initially a github submodule and the repo name had dashes. I thought that might have been the problem so I changed f2 to a directory and copied over the files. This has not solved my issue.
I have also tried using importlib.
I would expect that a.py is able to import b.py since it is able to when I run a.py directly.