My code is not working on any filename other than the file main.py

Problem description

here when i try to run the code from any other file , for ex: string.py. other than main.py the code is showing some error .
if multiple files present in replit with main.py even when you run other code the code in main.py will execute

Expected behavior

here the code should print hello

Actual behavior

instead it is showing No such file or directory

Steps to reproduce

so please check what is the case of problem

Browser

https://replit.com/@natamsravankuma/TepidSecondaryContent#string.py

OS

windows 10

Device if mobile

N/A

Plan

free tier

Please upload screenshots

:wave: Welcome to the forums, @natamsravankuma!
You named your Python file string.py, when it should be named main.py, as this is the default file to be run on Replit,

For your information, if you intend to run string.py instead of main.py, 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.


Images

Dots

Show hidden files

edited

1 Like

thanks for replying
after changing entry point the code in the given file is only executing instead main.py
cant we run the code in different files listed in file explorer

https://replit.com/@natamsravankuma/Python#variables.py

Hey, @natamsravankuma!
This is not currently a built-in feature in Replit, but you can follow these instructions to use a somewhat-accurate script to switch the current running file by figuring out which file was last edited:

(Do keep in mind this is not 100% accurate)

4 Likes

thanks a small doubt where should i run this code

No problem! You can put this code at the very beginning of your .replit file. You can refer to my original instructions on accessing this .replit files if you need assistance.

4 Likes