From 4eb755872a8810945b70c8f49794d639333be113 Mon Sep 17 00:00:00 2001 From: Pietro Battiston Date: Mon, 30 Mar 2015 11:52:11 +0200 Subject: [PATCH] Provide the notebook being imported with "get_ipython" --- examples/Notebook/Importing Notebooks.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/Notebook/Importing Notebooks.ipynb b/examples/Notebook/Importing Notebooks.ipynb index 7346212c2..44ae0ebc4 100644 --- a/examples/Notebook/Importing Notebooks.ipynb +++ b/examples/Notebook/Importing Notebooks.ipynb @@ -39,6 +39,7 @@ }, "outputs": [], "source": [ + "from IPython import get_ipython\n", "from IPython.nbformat import current\n", "from IPython.core.interactiveshell import InteractiveShell" ] @@ -138,6 +139,7 @@ " mod = types.ModuleType(fullname)\n", " mod.__file__ = path\n", " mod.__loader__ = self\n", + " mod.__dict__['get_ipython'] = get_ipython\n", " sys.modules[fullname] = mod\n", " \n", " # extra work to ensure that magics that would affect the user_ns\n",