In Jupyter my own little module is not loaded but in python/bpython is everything is fine. When typing
import sys
print(sys.path)
the path to my module will not in show in Jupyter but in python/bpython it is still there.
I am using:
- PYTHONPATH in .bashrc to include my module,
- Jupyter and bpython inside a virtualenv.
The most similar questions is this Cannot import modules in jupyter notebook; wrong sys.path
How to configure Jupyter to load my modules automagically?
Jupyter has its own PATH variable, JUPYTER_PATH.
Adding this line to the
.bashrc
file worked for me:Here is what I do on my projects in jupyter notebook,
Then, to affect changes in
customFunctions.py
,Jupyter is base on ipython, a permanent solution could be changing the ipython config options.
Create a config file
Edit the config file
The following lines allow you to add your module path to sys.path
At the jupyter startup the previous line will be executed
Here you can find more details about ipython config https://www.lucypark.kr/blog/2013/02/10/when-python-imports-and-ipython-does-not/