Feb-25-2023, 08:07 PM
(This post was last modified: Feb-25-2023, 08:07 PM by deanhystad.)
import is very different than C #include. #include pulls in code from a header file to be compiled into your module. import creates an object that is an interface to the imported module. When blink calls time.sleep(1), it does the following.
Blink says "Hey there time, can I use your sleep function?". Time says "Sure, whoever you are. Here it is. Have fun."
Importing the same module in multiple scripts is common and very efficient.
Decoupling modules is always good design. main.py should not import time. Only import wat you use directly. Blink needs time, main does not.
Blink says "Hey there time, can I use your sleep function?". Time says "Sure, whoever you are. Here it is. Have fun."
Importing the same module in multiple scripts is common and very efficient.
Decoupling modules is always good design. main.py should not import time. Only import wat you use directly. Blink needs time, main does not.