I am working on a little project and I don't really understand why I get the ModuleNotFoundError. I have the following directory structure:
My code imports the following:
import asyncio
import socketio
from core.databases.mongo_handler import create_donation, get_streamer
from core.models.donations import Donation
When I try to execute the code from the command line I get the following error:
(venv) user@host % python standalone/sockets.py
Traceback (most recent call last):
File "/Users/user/Project/standalone/sockets.py", line 5, in <module>
from core.databases.mongo_handler import create_donation, get_streamer
ModuleNotFoundError: No module named 'core'
I do not understand why I get that error.
Sone clarifications:
- I do not have
__init__.py
files in the different directories but it doesn't change anything with them, I have tried it. - I want to run the code from the root of the project which is why I run it with
python standalone/sockets.py