Question
When I try to activate main.py on linux bash with the command as follows,
python3 main.py The error message looking as below keeps appearing, and I cannot figure out why!!
File "main.py", line 1, in <module> import folder_beta.util_one File "folder_beta/util_one.py", line 1, in <module> ModuleNotFoundError: No module named 'util_two' Questions in more detail
The folder tree looks like as below:
folder_alpha ├── main.py └── folder_beta ├── __init__.py (empty) ├── util_one.py └── util_two.py main.py
import folder_beta.util_one import folder_beta.util_two .... util_one.py
import util_two ... When I executed the 'util_one.py' alone, it works perfectly fine but when I executed the main.py, the error keeps appearing.
Can anyone tell me how to fix this problem, please?
main.py, your package root path isfolder_alpha. Whenutil_one.pytry toimport util_two.py, it is trying to findutil_twoinfolder_alphapath. Since it doesn't exist, Python returns aModuleNotFoundError.