the following would be nicer: def run(): get_name() a = get_age() check_age(a) again() if __name__ == "__main__": run() In this setup your script will only be run if it's started by itself, but when using a import, the functions from the script can be executed separately.