Reputation: 339
I initially started learning Python in Spyder, but decided to switch to PyCharm recently, hence I'm learning PyCharm with a Spyder-like mentality.
I'm interested in running a file in the Python console, but every time I rerun this file, it will run under a newly opened Python console. This can become annoying after a while, as there will be multiple Python consoles open which basically all do the same thing but with slight variations.
I would prefer to just have one single Python console and run an entire file within that single console. Would anybody know how to change this? Perhaps the mindset I'm using isn't very PyCharmic?
Upvotes: 16
Views: 18635
Reputation: 59
To allow only one instance to run, go to "Run" in the top bar, then "Edit Configurations...". Finally, check "Single instance only" at the right side. This will run only one instance and restart every time you run.
Upvotes: 2
Reputation: 172
I think that what you are looking for is the last option in this window; check it and it should work.
Settings -> Build, Execution, Deployment -> Console
Upvotes: 0
Reputation: 3925
Hi: If you are looking for re running the code again in the same python console everytime then you have to check the respective box in the Project settings as shown in image below.
Upvotes: 15
Reputation: 8495
There is a specific option in PyCharm 2018.2+: Settings | Build, Execution, Deployment | Console | Use existing console for "Run with Python console".
Run with Python console is an option you have enabled in the Run Configuration. Disable it if you don't need a Python console after a script execution:
Upvotes: 26
Reputation: 23484
You have an option to Rerun the program.
Simply open and navigate to currently running app with:
And then rerun it with:
Another option:
Show actions popup:
And type Rerun ..., IDE then hint you with desired action, and call it.
Upvotes: 0
Reputation: 854
One console is one instance of Python being run on your system. If you want to run different variations of code within the same Python kernel, you can highlight the code you want to run and then choose the run
option (Alt+Shift+F10 default).
Upvotes: 0