Run a notebook from different directory in another notebook in Jupyter Lab Domino

366 Views Asked by At

I am trying to run notebook_torun.ipynb in test_notebook.ipynb within Jupyter Lab Domino from a different directory but have failed. The structure looks as such:

root -> mnt -> test_notebook.ipynb

and I want to run

root -> repos -> test-directory -> notebook_torun.ipynb.

My attempt looks as such:

%run ../repos/test-directory.notebook_torun.ipynb

However everytime the command seems to append .py on the end so the error is File ../repos/test-directory.notebook_torun.ipynb.py not found.

Is there anyway to stop this behaviour so that it knows it is a notebook? Thanks

1

There are 1 best solutions below

0
Wayne On

Did you try the following inside test_notebook.ipynb?

%run ../repos/test-directory/notebook_torun.ipynb

Or if you want to use the absolute path, you can use this if root is the same as home (it may not be though, see here.):

%run ~/repos/test-directory/notebook_torun.ipynb

You should be able to test and develop all this using ls (or %cd and pwd, with %cd ~/mnt to switch back to original location of your test_notebook.ipynb,) inside your notebook.