#!/usr/bin/env python3 import sys # lots of code here if __name__ == "__main__": # False if this module is imported print("executed as program") sys.exit(0) # let the OS know that everything went fine