'Run' only works with main.py
Just started my python journey and realise that the 'Run' button only works when I have the main.py file in my repl.
I tried to import a new file i added to the repl called "learn.py" by inserting import learn.py as the first line in main.py but it will not run.
The error I receive is: Traceback (most recent call last):
File "main.py", line 1, in <module>
ModuleNotFoundError: No module named 'learn.py'; 'learn' is not a package
Anybody knows how I could run files other than main.py?
1) did you add learn.py to your workspace?
2) did you import learn? You don't need the .py in the import statement
If you just use "import learn" then you need to use it like: learn.func(). -> better way
If you want to just use func(), then use from learn import * -> potential name clashes and unclarity