Unable to find locate folder in python directory. Getting the error: ModuleNotFoundError: No module named 'config'

I am trying to import a .py file in my project using relative paths but I'm having some issues. This is my project structure:

django_misinfo -config --init.py --definitions.py -scripts --scraper.py

This is my definitions.py:

import os
ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))

and this is my scraper.py:

import os
from config.definitions import ROOT_DIR

However, I get an error: ModuleNotFoundError: No module named 'config'.

I'm not sure what could be causing this, I've tried everything I can think of, including moving the structure of the folders around. It seems like a simple solution but I'm not sure what I'm doing wrong.

Thank you for your help.

Back to Top