Skip to main content

get_direct_submodules

FunctionSource

v_1: list[module] = get_direct_submodules(module: ModuleType, filtered_by_all: bool = True)

Get the submodules/subpackages directly defined in a package.

Arguments

Requires

NameTypeRequired
Description
moduleModuleTypeThe package to be analyzed. The submodules/subpackages are detected in it.
filtered_by_allboolA flag. If specified, will prefer the __all__ value defined in the module when searching members. In this case, any value not in the __all__ list will be ignored.

Returns

NameType
Description
v_1list[module]A list of module objects that are direct submodules/subpackages of the given module. If the module is imported from somewhere else, it will not be included.