Ask coding questions

← Back to all posts
Run button in Python editor: does it work only for main.py?
h
PaoloAmoroso (186)

It seems that the run button in the code editor of Python REPLs works only for the main.py file, not for other source files. Do I understand correctly?

I'm asking because when I click run in files other than main.py nothing seems to happen in the Python shell, no code is apparently evaluated.

Answered by mat1 (4381) [earned 5 cycles]
View Answer
Comments
hotnewtop
mat1 (4381)

Yes, main.py is the default file that is run and there's not really a practical way to change this at the moment. You can however, run other py files by doing import otherfile at the top of main.py.

Please upvote my comment if it was helpful or useful. Thank you!

PaoloAmoroso (186)

@mat1 Thanks, for the time being that's an acceptable workaround.

PaoloAmoroso (186)

@mat1 I've submitted a feature suggestion to make run work also in other Python source files.