Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • JetBrainsTV on youtube (https://www.youtube.com/watch?v=JLfd9LOdu_U)
  • JetBrains Website (https://www.jetbrains.com/help/pycharm/run-debug-configuration-python.html)
  • Stack Overflow

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

like image 290
Sam Wood Avatar asked Oct 28 '17 19:10

Sam Wood


1 Answers

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

like image 57
Arunmozhi Avatar answered Sep 22 '22 12:09

Arunmozhi