From f1b5613497917115e5e3dfa534c0ed7e053d9785 2015-03-30 16:52:53 From: Thomas Kluyver Date: 2015-03-30 16:52:53 Subject: [PATCH] Merge pull request #8194 from toobaz/get_ipython_in_import Provide the notebook being imported with "get_ipython" --- diff --git a/examples/Notebook/Importing Notebooks.ipynb b/examples/Notebook/Importing Notebooks.ipynb index 7346212..44ae0eb 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",