pkgutil.walk_packages()
pkgutil.walk_packages() is a Python function in the Pkgutil Module category. Yields (module_finder, name, ispkg) for all submodules in a package. The syntax is pkgutil.walk_packages(path=None, prefix="", onerror=None). Returns: Generator of (finder, name, ispkg) tuples. A typical example: import pkgutil
for finder, name, ispkg in pkgutil.walk_packages():
print(name, "(package)" if ispkg else ""). A close sibling is pkgutil.iter_importers(), which yields all registered importers. A close sibling is pkgutil.extend_path(), which extends the search path for a package (from __path__). More about this category: Package utilities — get_importer, iter_importers, walk_packages, extend_path. Related Pkgutil Module entries: pkgutil.iter_importers(), pkgutil.extend_path(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try pkgutil.walk_packages() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.