Reload an IPython extension by calling reload. If the module has not been loaded before, :meth:`InteractiveShell.load_extension` is called. Otherwise :func:`reload` is called and then the :func:`load_ipython_extension` function of the module, if it exists is called.
(self, module_str: str)
| 104 | return "no unload function" |
| 105 | |
| 106 | def reload_extension(self, module_str: str): |
| 107 | """Reload an IPython extension by calling reload. |
| 108 | |
| 109 | If the module has not been loaded before, |
| 110 | :meth:`InteractiveShell.load_extension` is called. Otherwise |
| 111 | :func:`reload` is called and then the :func:`load_ipython_extension` |
| 112 | function of the module, if it exists is called. |
| 113 | """ |
| 114 | |
| 115 | if BUILTINS_EXTS.get(module_str, False) is True: |
| 116 | module_str = "IPython.extensions." + module_str |
| 117 | |
| 118 | if (module_str in self.loaded) and (module_str in sys.modules): |
| 119 | self.unload_extension(module_str) |
| 120 | mod = sys.modules[module_str] |
| 121 | reload(mod) |
| 122 | if self._call_load_ipython_extension(mod): |
| 123 | self.loaded.add(module_str) |
| 124 | else: |
| 125 | self.load_extension(module_str) |
| 126 | |
| 127 | def _call_load_ipython_extension(self, mod): |
| 128 | if hasattr(mod, 'load_ipython_extension'): |