only main.py files is running. How to run the other files .py files
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 main.py only. How to made the compiler to run my file?
- Make a file named .replit
- Do this in the new file:
run = "python3 hello.py"
- If you want to delete main.py
- right click and go to the command pallet (or press F1)
- click on shell and a bash prompt should appear
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
then when you press run it should print what you wrote in the other files.
Happy coding and hope this helps! =)
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: filename.py then it will be and invalid syntax.
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
xxxand put that two files under that and can type
import commandand 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 Repl.it or other.
Hope this helps.
Please mark my answer if this helps.