if you just run the main.py
under the app
, just import like
from mymodule import myclass
if you want to call main.py
on other folder, use:
from .mymodule import myclass
for example:
├── app
│ ├── __init__.py
│ ├── main.py
│ ├── mymodule.py
├── __init__.py
└── run.py
main.py
from .mymodule import myclass
run.py
from app import main
print(main.myclass)
So I think the main question of you is how to call app.main
.