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
RYANTADIPARTHI

You will have to import that file into the main file, and it will run.

# different file def function(): print("hi") function()
# main.py from other file import function

Now run it, and it will work

Or, you can import that file.

# other file def function(): print("hi") function()
# main.py import filename

Any of those should work