Ask coding questions

← Back to all posts
How do I change which file to run?
STEPHENYOON1057 (0)

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?

Comments
hotnewtop
CoderBean (11)

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

Bookie0 (6031)

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.. :)

STEPHENYOON1057 (0)

@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?

Bookie0 (6031)

@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?