I am trying to call a module from a parent package.
My project structure -
be/
__init__.py
api/
__init__.py
models.py
alembic/
env.py
How to call models.py
inside env.py
I tried like below,
from api.models import Base
I get the error - ImportError: No module named 'api'
I thought of restructuring by putting the alembic
directory inside api
directory, still not able to import models
.
Using sys.path
looks hacky, if I should change the project structure, then please suggest.