I have a web service written in Python that has a class that contains handlers for client requests. Due to protocol complexity the number of handlers is high. All handlers are called inside separate thread (Controller class which is a subclass of Thread). To reduce the class size I've defined handlers in separate modules. The end result is below:
from handlers.main_handlers import delete_project, ...
class Controller(Thread):
_handle_delete_project = delete_project.handle_delete_project
...
def run():
while not self._stopped:
...
self._handle_delete_project(...)
...
Is there a more Pythonic way do to this? I mean to split a class into multiple files with a better pattern.