This is my current directory structure, I am trying to import a function from src/helpers/log.py
to src/data/download_dataset.py
. I have followed this answer but it still does not work.
|-- AUTHORS.rst
|-- CONTRIBUTING.rst
|-- HISTORY.rst
|-- LICENSE
|-- MANIFEST.in
|-- Makefile
|-- README.rst
|-- data
| |-- external
| |-- interim
| |-- processed
| `-- raw
| `-- wine-quality.csv
|-- docs
| |-- Makefile
| |-- authors.rst
| |-- conf.py
| |-- contributing.rst
| |-- history.rst
| |-- index.rst
| |-- installation.rst
| |-- make.bat
| |-- readme.rst
| `-- usage.rst
|-- dvc_mlflow
| |-- __init__.py
| `-- dvc_mlflow.py
|-- logs
|-- models
|-- requirements_dev.txt
|-- setup.cfg
|-- setup.py
|-- src
| |-- data
| | |-- __init__.py
| | `-- download_dataset.py
| |-- features
| | `-- __init__.py
| |-- helpers
| | |-- __init__.py
| | `-- log.py
| `-- models
| `-- __init__.py
|-- tests
| |-- __init__.py
| `-- test_dvc_mlflow.py
`-- tox.ini
I am importing the file log_error
in src/data/download_dataset.py
like so:
from helpers.log import log_error
But when I try to run the file using python3 src/data/download_dataset.py
I get the error ModuleNotFoundError: No module named 'helpers'
. I am a bit confused because I already added in the __init__.py
files in each of the directories to make them modules but the issue still persists.