How can I run my currently edited file in a PyCharm console in a way that I can type into the command line afterwards?
console, pycharm, python
Solution
Select the code fragment or the entire file, then use Execute Selection in Console from the context menu.
Problem
I want this so I can retain the command line history after repeated runs, and to paste lines from the console into tests etc. Exactly like in IDLE. [I realize this question is basically a duplicate of Running a module from the pycharm console. But the question there is not answered satisfyingly (for me), and my lack of reputation does not let me comment there, since I just signed up.]