Lani
Lani

Reputation: 35

How to run different files without manually changing the configuration?

I'm using Pycharm and I have an issue. I can't just click run and run files on their own, if they are in a project file. I can, but I need to keep changing and deleting the 'configurations' at the top right every time I switch files. It keeps creating new configurations every time I open a new file, which is why I changed the default value of 5 to 1. I did this so I don't have to keep deleting it, but I still have to change it every time I switch files and want to run that file. It's pretty annoying, is there anyway to just run the files like normal without having to change the configurations?

image 1

image 2

image 3

Upvotes: 0

Views: 124

Answers (1)

Tomerikoo
Tomerikoo

Reputation: 19422

Collecting comments to an answer:


Running a file need a configuration, which means how to run that file.

It's just not so necessary to worry about them and deal with them, using one of these ways:

  • Right-click the mouse anywhere inside the file view and press Run <filename>

  • ctrl+shift+F10 on windows

  • Use a main guard and Pycharm will add a small green arrow through which you can run the file directly:

    An image showing a single line of code: if __name__ == "__main__": with a green arrow added next to it automatically. The arrow is highlighted with a red circle

Upvotes: 3

Related Questions