Ask coding questions

← Back to all posts
only files is running. How to run the other files .py files
mail2kvanitha (2)

I am newbie to REPL. I am just checking how to use python online. I created a file but when ever i run my pythion script, it always runs the only. How to made the compiler to run my file?

ApoorvAgrawal (51)
  1. Make a file named .replit
  2. Do this in the new file:
run = "python3"
  1. If you want to delete
  2. right click and go to the command pallet (or press F1)
  3. click on shell and a bash prompt should appear
  4. type rm
chrisbarai (0)

@ApoorvAgrawal after deleting the file will i able to compile other files or i have to keep single file only different repositories?

PythAthu (0)

Hi @mail2kvanitha, I think you should run this code if the file is in a folder: from foldername import filename with or if you have the file outside any folder then you have to run this code: import filename. And if you put an extension eg: then it will be and invalid syntax.

PattanAhmed (1397)

@mail2kvanitha Hi,
I think You can import that file only if it is under a folder, As a project, Not just as another individual file...
You can create a folder and name xxx and put that two files under that and can type import command and try:- Your code should look like this.:-

import xxx
# And can use any code from that file.

Make sure that two files are under one folder anywhere whether it may be or other.

Hope this helps.
Please mark my answer if this helps.

Muffinlavania (1515)

just import hello in

import hello

then if you have this in,

print("I like turtles")

it will print that and whatever

Coder100 (17034)

Hi! There are 2 ways to do it:

Importing the file

import hello
# now the other file will be run along with yours!

Configuring the run button

Create a .replit file:

Bookie0 (5967)


you have to do this: from file_name import * (the star sign * means everything) and replace file_name with what you want. in your case its hello

then when you press run it should print what you wrote in the other files.

Happy coding and hope this helps! =)

mail2kvanitha (2)

i want python to run my other file