Skip to content

Instantly share code, notes, and snippets.

@NotZombieFood
Created August 2, 2019 05:24
Show Gist options
  • Save NotZombieFood/9f0b07861ef071c1db81aa7182e5dd45 to your computer and use it in GitHub Desktop.
Save NotZombieFood/9f0b07861ef071c1db81aa7182e5dd45 to your computer and use it in GitHub Desktop.
Python Script calls another script with arguments (py2 and py3)
# Master
import sys
backup_argv = sys.argv
sys.argv = ['slave.py','NotZombieFood']
if sys.version_info >= (3, 0):
exec(open("slave.py").read())
else:
execfile('slave.py')
sys.argv = backup_argv
# Slave
import sys
print("Hi %s"%(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment