Skip to content
← Back to Community
How do I change which file to run?
Profile icon
STEPHENYOON1057

When I tried to run my files after renaming them, it just said "No such file: main.py
repl process died unexpectedly: exit status 2?"
How do I change this so that it runs the renamed files?

Voters
Profile icon
ItsTato
Profile icon
LiamJayCoderALT
Profile icon
STEPHENYOON1057
Comments
hotnewtop
Profile icon
Coder100

Use a .replit file:

run = "python main1.py"

https://docs.repl.it/repls/dot-replit

Profile icon
Bookie0

What do we have to input to get that error? Also to run your file, you have to do:

from file_name import * # imports everything from that file # or from file_name import module_name # you can imports variables, functions, etc.

Is this what you wanted? Not quite sure.. :)

Profile icon
STEPHENYOON1057

@Bookie0
So the default name of the file is main.py, right? I changed it to main1.py, and it shows an error that there's "no such file: main.py." How do I fix this issue, so that it would run even if the file name's not main.py?

Profile icon
Bookie0

@STEPHENYOON1057 yep, default is main.py. And iirc you can't change the main.py file to something else. Also why do you need to run a file that isn't main,py?

Profile icon
LiamJayCoderALT

The question is totally valid so don't worry about it! Note that only the main.py runs so you have to import your auxilary files in main.py. If you include this code in main.py, from fonctiontest import *, the program will be able to use your code from fonctiontest.py.

Profile icon
[deleted]

make sure the file name in the code is correct...