I’m trying to structure my project like this
app/
__init__.py
web/
__init__.py
web.py
database/
__init__.py
db.py
I just want to import several classes from db.py to web.py but just a ImportError: No module named is thrown. What I tried so far
web.py
from __future__ import absolute_import
from database.db import ClassA
OR
from __future__ import absolute_import
from app.database.db import ClassA
OR
from __future__ import absolute_import
import database import ClassA
What do I missing?
// edit:
db/__init __.py
from db import ClassA
All other __init__.py are empty. I guess I’m doing something wrong on this.
Assuming:
where
__init__.pycontains:and the second
__init__.pycontains:and
db.pycontains:and
coolios.pycontains:and
test.pycontains:It should work.