I am writing some scripts for a bigger machine learning application. To keep it nicely structured, I have some subdirectories for different steps, e.g.
/
/preprocessing (containing preprocess.py)
/training (containing train.py)
/utils (config.py)
So what I would like to have, is a clean possibility to use code from utils in preprocessing and training modules. However, the problem is that I run the code directly in the subdirectories, e.g.
cd preprocessing
python3 preprocess.py
So this means that preprocessing is my main module and this cannot see anything that is contained in a higher directory, thus I also cannot import modules form utils.
I know that there would be some possibilities that include changing the PYTHONPATH, but I find this somehow ugly. Everybody using my code would have to do this. So my question is if there is a clean and recommended way of importing code from parent or sibling directories.