ipynb import another ipynb file from different directory

  import, ipython, jupyter-notebook, python, workflow

Importing functions from an external ipynb file works as intended if it is in the same directory. However, if I have a project with multiple directories, I would like to be able to import functions from other directories. I understand that it may be easier to use another IDE for this purpose, however, I am documenting my work and would like to continue leveraging Jupyter Notebook’s seamless Markdown integration.

I am not seeing anything in the ipynb.fs documentation here and answers on ipynb import another ipynb file and import a function from another .ipynb file all specify that documents must be in the same directory.

This is normally what I would do to import a function from an external ipynb file in the same directory,
from ipynb.fs.full.my_functions import split_into_sentences

I’ve moved my_functions into functions/ and I’ve tried this,
from ipynb.fs.full."functions/my_functions" import split_into_sentences

and
from ipynb.fs.full.functions/my_functions import split_into_sentences

Neither works.

Is there any workaround to this?

I am still fairly new to asking questions on here so I apologize if my question is posted incorrectly.

Source: Python Questions

LEAVE A COMMENT