I trying to understand how to manage module with __all. For example, I have following structured code:
main.py |=> /database |=> __init__.py |=> engine (with variables engine, session, etc.) now I want to be able to import session and engine instances directly from database module like:
from database import session I tried to add line __all__ = ['session'] or __all__ = ['engine.session'] to __init__py but when I trying to do import I've got an exception AttributeError: 'modile' object has not attribute 'engine.session'.
Is there any way to achieve wanted behavior?