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)