After looking at many answers here, I still dont understand how to structure a python project with imports...
Let's say my dir structure is
myproject
utils
tool1.py
datasets
create_bla_dataset.py
research
mynote.ipynb
now I import tool1 from create_bla_dataset.py with
# We are in create_bla_dataset.py
from ..utils import tool1
... define how to create a dataset
if __name__ == "__main__":
# demo the dataset
and I can run the file with
> cd <dir_contains_myproject>
> python -m myproject.datasets.create_bla_dataset
But now I want to import create_bla_dataset inside mynote.ipynb while opening mynote.ipynb with a jupyter notebook, but I have no idea how...
If I try from ..datasets import create_bla_dataset
, I get ValueError: attempted relative import beyond top-level package
edit: I tried launching jupyter notebook from various directories but no luck, same error.