I have a Python package with the following structure.
>python_package # package root directory
>app_one # subpackage directory
>__init__.py
>views.py
>app_two # another subpackage directory
>__init__.py
>views.py
Code for app_one/views.py
:
def show():
print('do something')
Codes for app_two/views.py
:
from app_one.views import show
show()
The problem is, whenever I try to run views.py
of app_two
from the terminal, I get an error
No module named 'app_one'
But when I open the package python_package
in the PyCharm IDE, I'm getting no issue, everything works perfectly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…