Running Pycharm Project with Intellij IDEA plugin



I need some help for the development of a pycharm plugin on IntelliJ IDEA. I would like to implement an action that will run one of my scripts in my pycharm project in my Pycharm IDE.

To be more precise, my plugin will be visible in the toolbar ("SpecRunning"), and you will be able to run the first or the second script (there will always be the same).

When I will click on “Run foo”, it will look for the script “” in my project folder and run it.


My issue is on the last step, I am able to find the path of my but I don't know how to make pycharm itself run the script with its current environment. The goal is that my action will be the same as doing rightclick + “Run foo” on pycharm IDE.

Thanks for your help


You have to check the SDKs used in the current project or module in your PyCharm instance and run it with that SDK. However I'm not sure this is actually a good idea. Why do you want to use two IDEs if you can have everything in one? It's just a run configuration for in IDEA with an SDK you specify.



I'm sorry, but I don’t understand your use case. Do you want to run a script in a project in PyCharm, and all this should be done from IntelliJ IDEA? This sounds strange. Could you please explain the use case in more detail?


Hello, thank you for your answers,

The users are working on Pycharm so the work I am currently doing will be used on this IDE. The goal is to put two scripts in their python project when they will create it (it will be at the creation I don't need to work on it), these scripts will be hidden and are running their code in a certain way if you use them (they will both run my but the first one simulate an environment and second one a second environment for exemple).

To make this as user friedly as I can, I want to create a plugin that will add buttons on their IDE that will perform “run with env 1” or “run with env2”. 

To create this pycharm plugin I understood  that I need to develop it with IntelliJ IDEA (If I am wrong do not hesitate to tell me). But I don't know how have the possibility to implement a function that will run a (hidden) script on pycharm in the same way as doing:

 “right click” + “run” on my pycharm IDE



Sorry, but I overlooked in your initial message that you want to implement the same behavior as in right-click a script and running it.

You can find this action and check how it is implemented with UI Inspector:

I also suggest getting familiar with the Execution topic:


Please sign in to leave a comment.