Ask coding questions

← Back to all posts
Only main.py file is running?
pradeepswami

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

Answered by TheDrone7 [earned 5 cycles]
View Answer
Voters
RicardoEspinoz3
nhjhs102076
PyeCd2r
laksjd34156
Professori1
Marvel50
cassio645
Devil156
Tessde
AaronCoelhoIran
Comments
hotnewtop
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.

pradeepswami

@TheDrone7 thanks

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 <module>
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.

TheDrone7

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

mayurkoshti12

@TheDrone7

Thanks for interest!

My Apologies! :)

Actually my import syntax was wrong in main.py