command pattern if __name__ ="__main__"invoker invoker(invoker add_command("function"text_writer"params"("command ""string "}invoker add_command("function"text_writer"params"("command ""string "}invoker run(for simple case like thisyou could just define lambda functionand you would not even have to write the function definition class invoker(object)def __init__(self)self commands [def add_command(selfcommand)self commands append(commanddef run(self)for command in self commandscommand["function"](*command["params"]if __name__ ="__main__" lambda string string print("writing {{}format (string string )invoker invoker(invoker add_command("function" "params"("command ""string "}invoker add_command("function"