How to make VSCode auto-reload external *.py modules?

I would have commented on leo's answer, but I don't have enough reputation. The leo's snippet in VSCode showed me that the setting is unknown. This is what worked for me:

"jupyter.runStartupCommands": [
    "%load_ext autoreload", "%autoreload 2"
],

Update: The ultimate solution. Just add this in you code.

%reload_ext autoreload
%autoreload 2

========================================== I could not find the way make python interactive of vscode auto re-fresh when the .py file changes. but I try importlib.reload(), it works some way.

import funcs
import importlib
importlib.reload(funcs)
from funcs import *

funcs is my .py files, and code above should be run when the file changes.


It is now possible to set up autoreload automatically by adding:

    "jupyter.runStartupCommands": [
        "%load_ext autoreload", "%autoreload 2"
    ]

to settings.json.