Skip to content
← Back to Community
how can i run my second file
Profile icon
iloveninjago

i want to run my second file but it always keeps on running main.py instead

Voters
Profile icon
Tanay2345
Profile icon
snair82
Comments
hotnewtop
Profile icon
[deleted]
import filename #do stuff here

Hope this works for ya! (PS make sure to import only the NAME of the file. Not file.py. Because python will see the .py as an extension to the import you are using which you 99% of the time wont have.

Profile icon
CodingRobot12

I found a program and someone did this:

import filename filename.Run()
Profile icon
CodingRobot12

actually try to import the programs and try to use it somehow.

Profile icon
CodingRobot12

I am not sure how to do that but I got for line 51 and between the strings, you should convert the variable to a string cause I got an error.

Profile icon
Coder100

Hello. You can configure the run button: Create a .replit file:

run="python path/to/second/file.py"

You can also import it:

# main.py import path.to.file
Profile icon
iloveninjago

ok @Coder100 i will try