This is my package hierarchy
app
|--__init__.py //Empty file
|--server.py
|--global_vars.py
|
|--handlers
|--__init__.py //Empty file
|
|--url1
| |--__init__.py //Empty file
| |--app1.py
| |--app2.py
|
|--url2
|--__init__.py //Empty file
|--app3.py
Now I want to import global_vars.py
inside app1.py
.
So I gave
import app.global_vars.py
inside app1.py.
But I get the following error:
import app.global_vars
ImportError: No module named app.global_vars
I should also mention that I am importing app1.py from server.py. server.py
is the file I am actually running. When server.py imports app1.py, app1.py
tries to import global_vars.py
and I get the above mentioned error
What am I doing wrong here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…