7 Answers
New AnswerI couldn't get the recommended code to work so I decided on using. def start(): print("example") start() start()
It didn't work. Module name is the name of my file right?(test.py). If so the code didn't work, gave me this error: File "C:\Users\Student\Desktop\Test.py", line 188,in <module> importlib.reload(test.py) NameError: name 'importlib' is not defined. Apologies if I fail to understand some things, I'm quite new to this. Should I be using the directory path in the module?
Just import 'importlib' module first because it is a module like your code, right? Then You can use reload function. Like this: from importlib import reload then, reload(test)
You must import your code aka module first. reload function just ..well.. reload specific module without restarting interpreter.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message