I'm facing a problem with a Data Science project in Python. I'm trying to import a module from a different directory, but I'm getting the error "ImportError: Attempted to import relative with no known parent package". I've read several answers related to this error, but I haven't been able to resolve the issue in my specific case.
The structure of my project is as follows:
├── notebooks (folder)
│ └── data_evaluation.ipynb
├── src (folder)
│ └── utils.py
│ └── webscraping (folder)
│ └── scraping_data.py
I would like to import functions from the utils.py module in both scraping_data.py and data_evaluation.ipynb.
I've tried several combinations of relative relationships, but none seem to be working. How can I resolve this ImportError error and import the util_db.py module functions correctly in different parts of my project?
Rate in advance for any help!
Some of the things I've tried:
from src.utils import function
from utils import function
from ..utils import function
from project.src.utils import function
PS: my project contains an empty init.py in all directories