class Demo(): def start(self, *args, **kwargs): print("start") def shutdown(self, *args, **kwargs): print("shutdown") def update_status(self, **kwargs): action = kwargs['action'] func = getattr(self, action, None) if not func: raise Exception task_id = func(**kwargs) demo = Demo() filter = {'action': 'start'} demo.update_status(**filter)
echo start