[PYTHON] Smoothly reload modules on jupyter

Introduction

When developing a self-made module, if you load the self-made module with jupyter and check the operation in order to check the behavior interactively, you need to restart the kernel every time you update the contents of the self-made module. This procedure is quite annoying, so I searched for a workaround and found it with ʻimport lib`.

manner

As mentioned above, use the ʻimport lib` module

In the case of ʻimport hoge`

ʻImportlib.reload` updates the module.

import hoge


import importlib

importlib.reload(hoge)

For from hoge import fuga

In this case, it is quite troublesome, and after reloading the from module, it is necessary to execute import again.

from hoge import fuga


import importlib

importlib.reload(hoge)
from hoge import fuga

Relation

--Reload from import in Python.

Recommended Posts

Smoothly reload modules on jupyter
Golang on jupyter
Jupyter on AWS
Hello X3DOM on Jupyter
Install octave_kernel on Jupyter [additional]
Run Jupyter on Ubuntu on Windows
Display PIL images on Jupyter
High charts on Jupyter notebook
View PDF on Jupyter Notebook
Label images on jupyter lab
Run Jupyter Notebook on windows
Formatting with autopep8 on Jupyter notebook
Use jupyter on AWS GPU instance
Run azure ML on jupyter notebook
Try running Jupyter Notebook on Mac