Hi,
I changed my python file from main.py to something else. But, it seems the console is still looking for main.py file which doesn’t exist anymore but I don’t want to rename that back to main.py again.
Is there any way to fix it?
Thanks
Inside your main.py
file, you can import your other Python file containing your code, e.g.
import codeFileName # don't need to add the .py extension
Your other code file can be called whatever; importing the name of it in your main.py file will ensure it runs as expected.
There is also a way to configure your Repl to run using a different file entirely, I’m currently in class though will get back to you with this shortly.
In your sidebar there is an option to “Show Hidden Files” (three dots submenu on top right).
Once you show hidden files you will see a file named .replit
.
Inside you will see the run button configured:
- look for
main.py
there and replace it with your file (egmyscript.py
).
Afterwards the run button will execute this one.
Configurations like that are described inside https://docs.replit.com/programming-ide/configuring-repl.
Hope this helps
It worked bro Thanks.
Also, you remembered me that other files can be also imported in a Python File.
Thanks
For your Solution
For your Time
For your Help
Have A Blessed Life
Hi,
It helped man thanks. Also, learned about accessing hidden files.
Thanks for your kindness and great help.
I really like the way you explained it.
Thanks & Best Of Luck
Have a blessed Life
You can do what @marinesetwas mentioned, but you can also go to shell and type:
python3 [file name].py
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.