from app.models import *
should do the trick
Domanda
Following my previous question, how can I import a module that is in a folder at the same level as the file importing it? I need to get to my models folder but importing it isn't working:
$ python generate_test_data.py
Traceback (most recent call last):
File "generate_test_data.py", line 6, in <module>
from models import *
ImportError: No module named models
Exception KeyError: KeyError(48562256,) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
My project structure looks like this:
/
- generate_test_data.py
- app/
-- __init__.py
-- models.py
Soluzione
from app.models import *
should do the trick