ipynb import another ipynb file

It is really simple in newer Jupyter:

%run MyOtherNotebook.ipynb

If you want to import A.ipynb in B.ipynb write

import import_ipynb
import A

in B.ipynb.

The import_ipynb module I've created is installed via pip:

pip install import_ipynb

It's just one file and it strictly adheres to the official howto on the jupyter site.

PS It also supports things like from A import foo, from A import * etc


Run

!pip install ipynb

and then import the other notebook as

from ipynb.fs.full.<notebook_name> import *

or

from ipynb.fs.full.<notebook_name> import <function_name>

Make sure that all the notebooks are in the same directory.

Edit 1: You can see the official documentation here - https://ipynb.readthedocs.io/en/stable/

Also, if you would like to import only class & function definitions from a notebook (and not the top level statements), you can use ipynb.fs.defs instead of ipynb.fs.full. Full uppercase variable assignment will get evaluated as well.