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`.
As mentioned above, use the ʻimport lib` module
ʻImportlib.reload` updates the module.
import hoge
import importlib
importlib.reload(hoge)
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
--Reload from import in Python.
Recommended Posts