I can’t figure out how to run my program in the console when I click the run button I am prompted to see the previous program which was created earlier was being running in the console and now I am unable to run my program as I created a new file and I tried running it. could you please help me figure out the solution for it asap.
Welcome to the community @RLDC!
Could you provide more information about the issue you are having? A link to the (cover page of) the Repl you are having issues with would help the community help you!
I mean to say that I created a python repl and I ran my first program by creating a file and now when I try creating a new file and try running the program I am able to see the previous program runs on my console
By default, only the main.py
file will run, you should be able to change this behaviour in the .replit
file.
how to change it man I’m confused
On the second line in the .replit
file you should see something like this: run = "python3 main.py"
. Change the main.py
to the file you want to run when you run your program.
man where can i find this .replit file
At the top of the file hierarchy on the left of the screen in the editor you should see three dots. Click them, then click ‘show hidden files’. You should see a few files appear, among them, the .replit
file you are looking for.
in the . replit file in which line do i have to change to run my next program
and also do I have to change my file name everytime by coming to this .replit file and changing it ?
Or you can just write main.py
to choose which file to run.
choice = input("Which file to use, 1 or 2?")
if choice == 1:
from otherFile import main # This imports the "main" function from "otherFile.py" in the same folder
main() # This runs def "main" from the file "otherFile.py"
elif choice == 2:
from secondFile import main
main()
It seems that the previous program was running another parallel thread that was unresolved?
Change the entrypoint
line.
You can change the entrypoint manually, or just use a different repl for each project, or