To reload the current running Python instance, there are 2 ways:
%load_ext autoreload %autoreload 2
or you need to preload the importlib library and then attached the given library to it:
importlib
import knight_wrapper import importlib importlib.reload(knight_wrapper)
This is a good one. Can be infuriating when modifying your .py file and even if you re-import it, it doesn’t implement the changes.
Wonder why it doesn’t do it by default?
In the first case, it can happen: if you load your py file before the %load_ext extension. In other words, make sure you load this piece of code before anything. For the second one, I never experience any issue so far.
%load_ext