Replit file problem

Please answer if I make 2nd file named and print(“Hi”) but I see always Hello world in the console. Please sir answer​:sob::sob::sob:

Hey @AseerAhnaf!

Just click the next to “Files” then click Show hidden files. Next click on the .replit file and finally you can change the entrypoint to whatever file you want to run.



Show hidden files


You should also see the docs on how to configure a Repl:

And if you want to run the last edited file, take a look at this post:


Replit is always going to run unless you tell it not to. not-ethan shows you how to tell replit to run a different file, but alternatively you can keep main as it is, and just have main run the code from your other file.

The easiest way to run code from another file is to define a function and import + call it in main:

import file2



def func():
1 Like

In addition to @ThomasWarenski’s solution, there is an unsuggested way to do so, which is directly import and ignore it.
import second
#rest of code here
#code here

That’s how python works, and you don’t need to worry about re-indenting your code under a brand new function. Though this exact reason is why it is a good practice for if __name__ == "__main__" in your code, preventing code above to work.

1 Like