Skip to content

Instantly share code, notes, and snippets.

@whal-e3
Created November 4, 2020 06:47
Show Gist options
  • Select an option

  • Save whal-e3/86133a0d2bbdd619be06703487219127 to your computer and use it in GitHub Desktop.

Select an option

Save whal-e3/86133a0d2bbdd619be06703487219127 to your computer and use it in GitHub Desktop.
Python import + if __name__ == "__main__":
# sand box 1 file -------------------------------------------------------------------
import SandBox2
if __name__ == "__main__":
print("Executed when invoked directly from SANDBOX 1")
else:
print("Executed when imported from SANDBOX 1")
# sand box 2 file -------------------------------------------------------------------
if __name__ == "__main__":
print("Executed when invoked directly 2 from SANDBOX 2")
else:
print("Executed when imported from SANDBOX 2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment