I have this simple project structure. In the project's home directory, I have a module called 'service_api.py',which is a top level package. In the same home directory, I created a "demo.py", which calls the service_api:
from service_api import get_result;
'get_result' is a function defined in service_api.
This works fine. However, after I created a sub-directory 'service/' under home and moved 'demo.py' into 'service/', and run the same program, it complains:
ModuleNotFoundError: No module named 'service_api'
It's a top level module, and why it can't be imported? This occurs in a terminal, but if I execute it in PyCharm, it is still fine.
What's the issue?