Main.py is always being run

Question:
there is main.py file in my folder and i written some code in it then i have created try.py file where i write some another code eg print(“Hi”) now when i try to tun try.py file i am unable to se Hi printed only my code from main.py file is getting runned not from the try.py file why so and how to fix?

Replit Profile: https://replit.com/@tmmahajan08

Hey @tmmahajan08!

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, and in this case try.py.

Images

Dots

Show hidden files

edited

You should also see the docs on how to configure a Repl: https://docs.replit.com/programming-ide/configuring-repl

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

3 Likes

You can directly run it from the shell using python [file_name].py. But if you want to run it by default, change the run command in .replit to 'python [file_name].py' as well as the entrypoint file.

Yes, and @tmmahajan08 note that if it is in a folder, use /folder-name/try.py for the entrypoint.

2 Likes