Ask coding questions

← Back to all posts
Running code with a new file
iamarka0 (9)

The 'main.py' file is running a code successfully. But when I am trying to code in a file created by me, the output is not coming. Please help.

Comments
hotnewtop
williamldn (5)

in the .replit file add:
language = "bash"
run = "python3 <filename.py>"

Then replace filename with main.py if you want this file to run again

21natzil (1182)

You can only run main.py files at the moment. You can import the other time files, and run them that way instead.

iamarka0 (9)

@21natzil I didn't understand the second part.

21natzil (1182)

@iamarka0 you can run another file by importing it. This is done differently depending on the language you you're using

ash15khng (710)

@21natzil If you're using Python, do import then your file name without the .py extension.