|You Are What You Decide:|
A Journey in Automation of Our Selves.
Wouldn't it be cool to import Jupyter Notebook just as a Python module? Well, there is a convenient way, you just need to add one line to your Jupyter configuration to execute several Python functions. So, do:
1. Generate the profile files.
$ jupyter notebook --generate-config
2. Edit the jupyter_notebook_config.py to append:
c.InteractiveShellApp.exec_files = [ "/home/you/.jupyter/notebook_finder.py" ]
Where the runatstartup.py should be the path to the following file:
Then, you will be able to import other Jupyter notebooks just like Python libraries :)
Additionally, you just need an empty __init__.py file in your root folder of IPython Notebook, and in every deeper level folder which you want to import from. With that, if you have a folder named "nbpackage" and "mynotebook.ipynb" inside it, you can do:
from nbpackage import mynotebook
import mynotebook mynotebook.function()
if you are in the folder already. Works just like Python package imports.