class BaseClass: def __init__(self, gui): self.gui = gui self.drawing = True async def draw(self): pass async def dispatch_event(self, event_type, *args, **kwargs): try: coro = self.__getattribute__("on_" + event_type) except AttributeError: pass else: await coro(*args, **kwargs) class MainClass(BaseClass): async def on_pygame_keydown(self, event): print("prout")