Launching a notebook from a notebook

I am trying to control a jupyter notebook ("Notebook1.ipynb") from another jupyter notebook("Notebook2.ipynb") . Everything works fine, except the cell which opens the second notebook never returns, even after halting and closing the tab.

  1. The contents of “Notebook1.ipynb”:

    In [1] !runipy Notebook2.ipynb OutputNotebook.ipynb

    In [*] !jupyter notebook ./OutputNotebook.ipynb

     [I 13:54:47.711 NotebookApp] The port 8888 is already in use, trying another port.
     [I 13:54:47.717 NotebookApp] Serving notebooks from local directory: /home/user/Documents/testing_jupyter
     [I 13:54:47.717 NotebookApp] 0 active kernels
     [I 13:54:47.718 NotebookApp] The Jupyter Notebook is running at:
     [I 13:54:47.718 NotebookApp] http://localhost:8889/?token= [REMOVED] 
     [I 13:54:47.718 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
     [C 13:54:47.718 NotebookApp] 
     	Copy/paste this URL into your browser when you connect for the first time,
     	to login with a token:
     		http://localhost:8889/?token= [REMOVED] 
     [I 13:54:47.916 NotebookApp] Accepting one-time-token-authenticated connection from
     [W 13:54:48.778 NotebookApp] Notebook OutputNotebook.ipynb is not trusted
     [I 13:54:48.951 NotebookApp] Kernel started: [REMOVED]
     [I 13:54:49.579 NotebookApp] Adapting to protocol v5.1 for kernel [REMOVED]
     [I 13:55:13.839 NotebookApp] Starting buffering for [REMOVED]:[REMOVED]
     [I 13:55:14.143 NotebookApp] Kernel shutdown: [REMOVED]
     [W 13:55:27.569 NotebookApp] 404 DELETE /api/sessions/[REMOVED]( Session not found: session_id='[REMOVED]'
     [W 13:55:27.570 NotebookApp] Session not found: session_id='[REMOVED]'
     [W 13:55:27.570 NotebookApp] 404 DELETE /api/sessions/[REMOVED] ( 2.06ms     referer=http://localhost:8889/notebooks/OutputNotebook.ipynb
     In [*] print("back")
  2. The contents of “Notebook2.ipynb”:

    [ ] print("Wow!")

  3. The contents of “OutputNotebook.ipynb”:

    In [1] print(“Wow!”)

Any ideas?

I tired to do stuff with subprocess, but the best I can figure out is to call:


which returns immediately, but is the only method I can find that actually will halt the kernel if selected in the launched tab.