I'm creating a package in Python 3 and I have it structured as follows:
pkg
--mypackage
--downloader.py
--predicter.py
--weights
-- mood.joblib
test.ipynb
For doing tests in test.ipynb, I'm importing the package as follows:
from pkg.mypackage.downloader import Downloader
from pfk.mypackage.predicter import Predicter
The file "mood.joblib" must be read from the script "predicter.py", due this script contains the class Predicter() with a method that needs the file "mood.joblib", but it is generating this error in my file "test.ipynb":
FileNotFoundError: [Errno 2] No such file or directory: 'weights/mood.joblib'
I know the error is created because the file "test.ipynb" is not on the same path as the class Predicter(), contained in "predicter.py". So, my question is How can I call this class and its associated files, keeping the structure of my package, from another file that is anywhere on my computer?