PyCharm: Run recent open file, not previous one


I use PyCharm and I have created a new file, while the previous one I used,, still remains open in the program.
I am now writing code in, then hitting shift/F10 to run this code and show it in the terminal.

What happens is, that is being run, although I am in now.

How can I assure that runs // that that file runs, which I am now at & have opened in the window?!

Any idea,

or am I doing something wrong here?


With my keymap configuration (XWin Proper Redo), SHIFT+F10 executes the current “Run configuration”, i.e. in most cases re-runs the last executed file, and CTRL+SHIFT+F10 runs the currently opened file. I think that’s the one you’re looking for !

1 Like

Yep, worked.

Again, big thanks :slight_smile: