I have two packages, a and b. They are in the same directory, and b is dependent on a (but NOT the other way around). When I run from . import a in b\some_package.py, I get ImportError: cannot import name a. When I run import a (from the appropriate directory), there is no error. Both packages have __init__.pys. This answer explains why fairly well, but does not mention how to fix this. How can I fix this?
File structure:
parent_directory
a
__init__.py
module_in_a.py
b
__init__.py
module_in_b.py (this imports a)