Search code examples
python-3.xpycharm

Do I need multiple run configurations - one per Python file - in Pycharm even though the only difference between them is the script?


I created a Python project in Pycharm which contains multiple Python files. As of just now, I need to create a run configuration for each Python file in my project, even though they're all the exact same - with the exception of the script.

This seems unnecessary and laborious and I would love to just use one run configuration for multiple Python files.

That said, I'm a novice Python programmer just getting started and so still unfamiliar with large parts of the language.

My Project Files:

enter image description here

My Run Configuration - Used for all Python files:

enter image description here

Some Research Carried Out

I've searched for a solution and explanation to this, but have been unable to find anything. Some of the places I've tried:

I hope there is sufficient detail here, if not I'd be happy to elaborate.


Solution

  • If those files are independent and you have nothing specific to them, then I see two simple ways of running them:

    1. You don't have to manually create a run configuration for every file. You can just Right-Click on the file in the project tree and click "Run "

    Running from the context menu

    1. You can use the Terminal and run them files using the python interpreter as needed.

    enter image description here