def load_all_modules()

in cortado/rtas/__init__.py [0:0]


def load_all_modules():
    dir_path = importlib.resources.files("cortado.rtas")
    log.debug(f"Loading RTA modules. dir_path={dir_path}")

    failed_imports: list[str] = []
    for module_file in dir_path.glob("*.py"):  # type: ignore
        name = module_file.stem  # type: ignore
        try:
            _ = importlib.import_module(f".{name}", package="cortado.rtas")
        except Exception:
            failed_imports.append(f"{name}")
            log.error(f"Can't import module `{name}`, skipping", exc_info=True)
            continue

    if len(failed_imports) > 0:
        log.warning(f"{len(failed_imports)} failed module imports")

    log.info(f"RTAs loaded: {len(_REGISTRY)}")