Script or library - import


If it is imported by another module then it won't run automatically. We have to call it manually.


examples/modules/import_mymodule.py

import mymodule

print("Name space in import_mymodule.py ", __name__)
mymodule.run()
$ python import_mymodule.py
Name space in mymodule.py  mymodule
Name space in import_mymodule.py  __main__
run in  mymodule