I wanted to ask how to run in Jupyter Notebook the %run command. So say I have another notebook I want to run in parall called notebook.ipynb. However, I want to call this command to the notebook name from string. So I want something like this:
name = 'notebook.ipynb'
exec("%run "+name)
This results in an error.
How can I overcome this? Thanks
os.system(f'%run {name}')(firstimport os) this runs it from cmd on windows tho don't know about other os%runis not Python, it's a Jupyter thing, so it makes no sense to the interpreter if you try toexecit. Look instead at the way to do what you want in Python. It's called thesubprocessmodule.Traceback (most recent call last): File "C:\Users\...\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3319, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-7-13fcb148f6bc>", line 1, in <module> exec('%run construct_mono.ipynb') File "<string>", line 1 %run construct_mono.ipynb ^ SyntaxError: invalid syntaximport subprocess subprocess.run("construct_mono.ipynb")but it gives me an error as well. I just want to run the entire notebook in parallel.