Temporarily run files in Python Console


I want to temporarily run my python program in console instead of the run tab. But after selecting run from console, I'm stuck in that configuration. After every console output, I have to manually disable 'run form console' in the Run>Edit Configurations... option to revert back to the default run configuration.

Is there any way to execute a program in console for just one time, without changing the run configuration permanently? I want to run my program with the python console for a single instance.


Hi, there's no simple way to do it, unfortunately. I created a ticket in our bug tracker to address this problem: https://youtrack.jetbrains.com/issue/PY-31741


Hi Saipranav1289! There is a workaround for your use case: https://youtrack.jetbrains.com/issue/PY-31741#focus=streamItem-27-3067939-0-0

"As a temporary workaround you can run your Run configuration once with the option "Run with Python console" enabled, disable it, but leave this Console instance alive. A command runfile(...) saves in console history, so you can just select this command from history (press Arrow up) and call it without running your Run configuration."


Please sign in to leave a comment.