Skip to content

Instantly share code, notes, and snippets.

@kasimte
Created February 7, 2021 11:40
Show Gist options
  • Select an option

  • Save kasimte/797ba6c1521c34bd16b133957ddbbfae to your computer and use it in GitHub Desktop.

Select an option

Save kasimte/797ba6c1521c34bd16b133957ddbbfae to your computer and use it in GitHub Desktop.

Revisions

  1. kasimte created this gist Feb 7, 2021.
    10 changes: 10 additions & 0 deletions run_script_with_config.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    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)