Skip to content

Instantly share code, notes, and snippets.

@kasimte
Created February 7, 2021 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasimte/797ba6c1521c34bd16b133957ddbbfae to your computer and use it in GitHub Desktop.
Save kasimte/797ba6c1521c34bd16b133957ddbbfae to your computer and use it in GitHub Desktop.
Run an external python script with object properties
class Config:
def __init__(self, a, b):
self.a = a
self.b = b
config = Config(1, 2)
script = "./my_script.py"
# note the "" around config
command = "python {script} \"{config}\"".format(script=script, config=vars(config))
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment