Answer the question
In order to leave comments, you need to log in
How to import from a module?
Project Structure
├── db.py
├── __init__.py
├── main.py
├── migrations
│ ├── env.py
│ ├── __pycache__
│ │ └── env.cpython-37.pyc
│ ├── README
│ ├── script.py.mako
│ └── versions
from ..db import DATABASE_URL, metadata
ImportError: attempted relative import with no known parent package
from db import DATABASE_URL, metadata
ModuleNotFoundError: No module named 'db'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question