How to use %run command to execute another notebook using file path?

Viewed 36

Let's say I have two notebooks nb1.ipynb and nb2.ipynb. If they are in the same folder I can run one from another simply by, for example:

%run ./nb2.ipynb

But I wasn't able to get it run when they are in different folders. I tried to use the file path but couldn't get it work, perhaps because my file path has blank spaces. Code like this

%run ./'C:/myusername/My Folder/nb2.ipynb'

returns an error:

Exception: File `"./'C:/myusername/My.py"` not found.

Can you give a hint how to fix it?

EDIT: Following Devyl's suggestion, this works:

%run "C:/myusername/My Folder/nb2.ipynb"
0 Answers
Related