defimport_object(module:Path,app:str)->object:"""Import an object from a module. Args: module: The path to the module file. app: The name of the object to import. Returns: The imported object. Raises: FileNotFoundError: If the module file is not found. ValueError: If the module has no loader. AttributeError: If the object is not found in the module. """spec=spec_from_file_location("mode",f"{module}.py",submodule_search_locations=[str(module.parent.absolute())],)ifspecisNone:# pragma: no coverraiseFileNotFoundError(module)mod=module_from_spec(spec)loader=spec.loaderifloaderisNone:# pragma: no coverraiseValueError(f"{spec} has no loader")loader.exec_module(mod)try:obj=getattr(mod,app)exceptAttributeErrorase:raiseFileNotFoundError(module)fromereturnobj