Skip to content
← Back to Community
Only main.py file is running?
Profile icon
pradeepswami

newly created file are not running. only main.py file runs. what is solution?

Answered by TheDrone7 [earned 5 cycles]
View Answer
Voters
Profile icon
StevenStojanovs
Profile icon
GeraldOsterman
Profile icon
RicardoEspinoz3
Profile icon
nhjhs102076
Profile icon
PyeCd2r
Profile icon
laksjd34156
Profile icon
HajunDevelopers
Profile icon
Marvel50
Profile icon
cassio645
Profile icon
Devil156
Comments
hotnewtop
Profile icon
TheDrone7

repl.it by default only runs the main.py file. That is why you may be even unable to run it. If you make other files, you can import them into your main.py file to run them. Or the better option would be to put the code that is to be run simply in the main.py file.

Profile icon
pradeepswami

@TheDrone7 thanks

Profile icon
mayurkoshti12

@TheDrone7

I have two files called main.py and test.py but when I run main.py I am getting the following error:

Traceback (most recent call last):
File "main.py", line 1, in
test.py
NameError: name 'test' is not defined

I have just written test.py in main.py file.

Sorry for that but I am a newbie on repl.it platform.

Profile icon
TheDrone7

@mayurkoshti12 Can you please provide a link to your repl?

Profile icon
mayurkoshti12

@TheDrone7

Thanks for interest!

My Apologies! :)

Actually my import syntax was wrong in main.py

Profile icon
V-SaiSai

what is the import syntax
@mayurkoshti12

Profile icon
ch-gz

I'm a newbie too. I just found this problem. Actually, you can type "python yourpyFile.py" in the shell tab that will work.