Ask coding questions

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

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

Answered by TheDrone7 (1777) [earned 5 cycles]
View Answer
Comments
hotnewtop
TheDrone7 (1777)

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.

mayurkoshti12 (2)

@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 (1777)

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

mayurkoshti12 (2)

@TheDrone7

Thanks for interest!

My Apologies! :)

Actually my import syntax was wrong in main.py