Reload notebook without kernel restart

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:

    import knight_wrapper
    import importlib
    importlib.reload(knight_wrapper)
1 Like

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?

1 Like

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.

1 Like