Suppose I have a module rules
with the following structure:
rules
├── conditions.py
├── __init__.py
In the script conditions
If you get
ImportError: attempted relative import with no known parent package
when you do like
import . from something
especially from the script executed, just try
from __init__ import something
Even though it could be problematic when there are many __init__.py
s in sys.path
, it would be helpful in some simple situaions.