Created
February 7, 2021 11:40
-
-
Save kasimte/797ba6c1521c34bd16b133957ddbbfae to your computer and use it in GitHub Desktop.
Run an external python script with object properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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