Skip to content
Sign upLog in

How to run files that are not named main.py?

Profile icon
KarthikeyanM2

By default, repl runs files that are main.py but If I want to run someother file. How can I run it?

You are viewing a single comment. View All
Answered by Coder100 [earned 5 cycles]
View Answer
Profile icon
OneNose

You can use os.

> from os import system > system("python dummy.py")

Run that in terminal.

Profile icon
OneNose

You can also import the module and then run it, but only after you ran main.py once.

> import dummy

It might be a better solution than the above.

Profile icon
OneNose

There is also a way to configure the run button, but that will change the whole program and is only good if you want to rename main.py but not if you want to test a specific module.


@OperationDemon
explains this.