Python 3.15+sysfunction
sys.get_lazy_imports_filter()
modules
Returns the installed lazy-import filter, or None if there is none.
Syntax
sys.get_lazy_imports_filter()
The filter is installed with sys.set_lazy_imports_filter and decides, for each potentially lazy import, whether to load the module immediately. Reading it is useful to swap the filter temporarily and then restore the previous one, instead of resetting someone else's setting to None.
Examples
import sys
print(sys.get_lazy_imports_filter()) # → None
See also
Open in the full glossarydocs.python.orgReport an inaccuracy