Any way to prevent auto restart on changes when in debug?

Hello! I find it annoying  that when I debug something, then make a change to the code while having an active breakpoint, like change one line at most, then I alt-tab to check something, in another program on in browser. And because of that one change my code restarts(change detected), I lose my "state" that I had when I was debugging and an error occurs because I hadn't finished writing code when I alt-tabbed.

This is awesome when I'm not debugging - not having to manually restart every time. And it detects when I change windows, as to not restart amid coding. But I'd like it to not occur when there's an active breakpoint in the debug mode.



Are you working on Django/Flask project by any chance? Are you referring to the automatic web server restart? If so, you can enable "no reload" option in your Django server run/debug configuration.

You can also disable all autosave options from **Preferences | Appearance & Behavior | System Settings**, and save changes explicitly when you want to restart the server. 


Andrey, thanks for the reply. 
The thing is yes, I'm working with these or similar framework, but I want to keep the functionality for regular non-debug runs, but avoid it for debug runs, because it endlessly pauses on error points.


Well, for Django I can only suggest using two separate run/debug configurations, one with "no reload" feature. Other frameworks should also have a similar option you can add to the additional arguments.


Yes, I'll probably just turn it off for debug. Seems there's no automatic way to do it via Pycharm, so launch params are needed. Thanks.


Each run configuration should have two sets of parameters, one for run action and another for debug action. The latter one being the same as for the run action when not specified.

Here somoene wished for hot-reload while debugging which is not restarting whole application but reloading only changed module – PyCharm & Python: Autoreload modules when in debug mode? 

Related How to prevent code from auto-restarting on code changes while debugging in PyCharm?


Please sign in to leave a comment.