I seem to me missing some basic information, and I have spent hours looking for an answer.
If course I can run this code. It works the same whether the file is on my PC or on the Pico W.
def say_hello():
print( 'Hello, world, no import!' )
say_hello()
But this does NOT work when split into two files stored on the PC:
In script.py:
import mymodule
mymodule.say_hello()
In mymodule.py:
def say_hello():
print( 'Hello, world, files on Windows!' )
The error message is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'mymodule'
However, if I copy the same two files to / on the Pico, they run fine. It also works if script.py is on the PC and mymodule.py is on the Pico.
1) Why is it different on the two platforms?
2) How can I make this work for files on my PC. This is going to be a fairly large project, and I'd rather minimize the number of files stored on the Pico.
I am new to the Pico and to Thonny, but I have been programming for years, mainly in C and Java with some Python more recently. I have rarely been stumped by something so seemingly simple.
Thanks for any help.
Steve