Skip to content
← Back to Community
Run file other than
Profile icon

I have created a file with another name. When I run, it does not run. Do I have to do any change in the setting?

Profile icon
Profile icon
Profile icon

By default, is the file that gets run (so that you can have projects split up into multiple files, but it's still only one project)

If you want to run other files, either use the python command in the command window or use a .replit file.

Profile icon

Thanks everyone for your reply. Really appreciate it.

Profile icon

Oh, I had the same question. There are 2 ways to do this.

Either type python3 and the file name in the place where runs.



Type 'import os' in the file. Then, you can type code in, if you want, and at the end of the file you can type 'os.system("python3")'. Then run The file will run after all the code in


Profile icon

@Whippingdot , Thanks for your response. I found the way similar to your suggestion.
Type import [file name]. Run Make sure your file name has an extension .py .
Code will run wherever you have your import syntax.

Profile icon

To do this, you need to either comment out the main code or if you want to run that file with the main code just leave it.

At the start of, add this to import the seconde py file.
from <filename> import <filename>

Note: filename should not include .py
For Example, my file name is
I would do: from authorize import authorize

Next is running it. To run it you can call it like a function.
So in my case, that would be...
Do note that you can change how you call it,aka alias,by adding an extra line while importing it.
from authorize import authorize as auth
As you can see, I used the as keyword to make an alternative of running that file.
Now, it would be auth().
Hope I have helped you :)