import importlib from .exceptions import ExceptionHandlerRoute module_path = [ '.auth.views' ] routers = [] docs = [] for path in module_path: module = importlib.import_module(path, package = 'app') if hasattr(module, 'router'): assert(type(module.router.route_class == ExceptionHandlerRoute)) routers.append(module.router) if hasattr(module, 'docs'): tag = module.router.tags[0] docs.append({"name" : tag, "description" : module.docs})