I am working on python code in Visual Studio Code and use several files for functions, which I import at the beginning of a script. Let's say for example I have a file "doStuff.py" in the same folder as my main script with the content
def doStuff():
print('I am doing stuff!')
# print('lots of stuff.')
which I would then import in another script, e.g. "main.py" by writing
from doStuff import doStuff
doStuff()
If I now run the script and afterwards e.g. uncomment the second line of the function in doStuff.py, I would expect to see the new behavior of my doStuff() method. Unfortunately this doesn't happen. I recently switched from Spyder to VSCode and in Spyder this always used to work automatically, but it seems VSCode does not auto-reload the imported modules.
Some info about my current workflow: To open the programming environment, I use "File/Open Folder" and select the folder in which main.py and doStuff.py are located. I am then using "Run Current File in Python Interactive Window" to start my scripts. I am guessing there are better ways and it might have something to do with the launch.json file, but so far the only way I have found to make it use the changed external symbol is restarting VSCode.
Edit: The issue here: Visual Studio Code: Auto-refresh file changes is different, if I understand it correctly, since it is about externally changed files to be reload in VS-Code. My issue is concerned with python modules being reloaded in the interactive window.