Everfighting
8/24/2017 - 3:53 AM

A module's __name__ if __name__ == '__main__'

A module's name if name == 'main'

#!/usr/bin/python
# Filename: using_name.py

if __name__ == '__main__':
	print 'This program is being run by itself'
else:
	print 'I am being imported from another module'
    
# ------------output-----------------
$ python using_name.py
This program is being run by itself

$ python
>>> import using_name
I am being imported from another module