Script or library
- main
- name
We can have a file with all the functions implemented and then launch the run() function only if the file was executed as a stand-alone script.
def run():
print("run in ", __name__)
print("Name space in mymodule.py ", __name__)
if __name__ == '__main__':
run()
$ python mymodule.py
Name space in mymodule.py __main__
run in __main__