Python: Import from multiple folders

Some learnings with folder structure and import with Python, I was trying to make a REST Api using Python and Mongo db. My initial folder structure was like this I had problems with import, I was creating my Flask app in api.py, and I wanted to import my database functions into api.py and I was doing like this “from app.database.db import….” which somehow strangely conflicted the Flask app instance “app = Flask(name)”. Was giving ModuleNotFoundError: No module named ‘app’ Then I made the structure as below, renamed a few folders Then I had problems in accessing db.py as well as …

Continue Reading