From 66ef16105a1c47d99a5f19e8ef28776c1289e8dc Mon Sep 17 00:00:00 2001 From: Samuel Sloniker Date: Tue, 9 Sep 2025 12:52:00 -0700 Subject: [PATCH] gh-85076: Document exceptions that can be raised by importlib.import_module (GH-94662) --- Doc/library/importlib.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index ddf503af82d9..7eb048fcfc28 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -124,6 +124,10 @@ Functions need to call :func:`invalidate_caches` in order for the new module to be noticed by the import system. + If the module cannot be imported, :func:`import_module` will raise + :exc:`ImportError` or an appropriate subclass like + :exc:`ModuleNotFoundError`. + .. versionchanged:: 3.3 Parent packages are automatically imported. -- 2.47.3