padawan
padawan

Reputation: 1315

How to run Main.py automatically in PyCharm

I prefer using a Java-like organization with my projects. For instance, each class has a different .py file as well as class Main, which only contains main function.

Each time I make a change in one of my classes, I need to click on Main and run the code (Ctrl+Shift+F10) from there.

How can I define my Main class as my main() function just as in Eclipse?

Upvotes: 0

Views: 2031

Answers (1)

grdaneault
grdaneault

Reputation: 840

You can create "run configurations" like in Eclipse.

The name of the thing in the dropdown is the run that you want and should not change between changing files. Clicking the triangle (or using alt-shift-X under the eclipse keymap) should run that configuration. In the dropdown you have the option of selecting whatever file you want to run.

run area

Upvotes: 2

Related Questions