Runtime loading of modules
During the importing any code that is outside of functions and classes in the imported module is executed. (print Loading mygreet).
Then you can call functions from the module (print Hello World).
Or call code that is in the importing program (print DONE).
def hello(): print("Hello World") print("Loading mygreet")
print("Start running") # Start running import mygreet # Loading mygreet mygreet.hello() # Hello World print("DONE") # DONE