Reload code in debug mode
Answered
Hi!
I'd like to know if there's a way to edit the code while debugging. Suppose the line that I want to change is not reached, like this

Here I'd like to change line 4 to, say, "b = 1 / (a + 1)" and then continue to debug, without restarting.
I heard that there's workaround with importlib.reload(), is there an easy way to reload module in the current frame? Or any other solution?
Thank you!
Please sign in to leave a comment.
Unfortunately, there is no feature for that.
See https://stackoverflow.com/questions/23333815/is-there-edit-and-continue-in-pycharm-reload-code-into-running-program-like-i?answertab=votes#tab-top for another possible workaround.
Feel free to vote for the corresponding feature request https://youtrack.jetbrains.com/issue/PY-23546
Thanks, Sergey!
Still haven't found a way to reload a debugger, but now I know it's currently not implemented in Pycharm. Surprised that this feature has so few votes ;(
You can try my PyCharm plugin Reloadium that adds hot reloading ( aka edit and continue) to any python application.
https://github.com/reloadware/reloadium
https://plugins.jetbrains.com/plugin/18509-reloadium
If you have objects in your code that you don't wan't to reload you might need to wrap them with # reloadium: no_reload as described here:
https://reloadium.io/documentation/decorators