Run scripts in console interactively

This might be a rather generic question, but I couldn't find anything on the web.

When I run a script/module in the python console, all the variables which were defined during the execution of the file are still available within the console. But when I run another script in the same console, that script cannot access these variables. Now I know that this is the default behavior in python. Upon execution, a new namespace is generated for the script. However in ipython it is possible to run a script interactively with the already existing namespace of the console by %run -i script.py. Shouldn't that somehow be possible in PyCharm as well? It's essentially using ipython anyway, right? I looked for something in the run configurations, but could not find anything.

So does anybody if this works? If yes, how? Thanks in advance for your help.

Please sign in to leave a comment.