Ask coding questions

← Back to all posts
How to run files that are not named

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

Answered by Coder100 [earned 5 cycles]
View Answer

There are two ways to do this.

1. Creating a .replit file

Creating a .replit file changes what file is being run.

Change <file> to your other file. Maybe dummy?

2. Importing files

Importing files will allow you to run both files one after the other.


Thanks for all the answers.


On the

make a file with name ".replit", and type:

Importing the file

you can do things like:


Create a .replit file, and type "run = ""
replace example file with whatever file you are using


Hello I have come to help!!

what you can do is put that file in a function and call it in main, I would say that is the easy whay.

To call a function in another file you have to do this in your main file or where you want to call it:

example is the file you want to import where you have stored your function!

Hope it helped!


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

Now run it, and it will work

Or, you can import that file.

Any of those should work


You can use os.

Run that in terminal.


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

It might be a better solution than the above.


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 but not if you want to test a specific module.
@OperationDemon explains this.