diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 28b9649a163..69e0f66dee4 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1775,6 +1775,8 @@ are always available. They are listed here in alphabetical order. goals and does not cause issues with code which assumes the default import implementation is in use. Direct use of :func:`__import__` is also discouraged in favor of :func:`importlib.import_module`. + Usually function returns :class:`types.ModuleType` object, but no guarantees + for that. If nothing found :exc:`ModuleNotFoundError` will be raised. The function imports the module *name*, potentially using the given *globals* and *locals* to determine how to interpret the name in a package context. diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index cfde3a47f75..8f7beb36c57 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -90,9 +90,9 @@ Functions .. function:: import_module(name, package=None) - Import a module. The *name* argument specifies what module to - import in absolute or relative terms - (e.g. either ``pkg.mod`` or ``..mod``). If the name is + Import a module, for return value information see :func:`__import__`. + The *name* argument specifies what module to import in absolute or + relative terms (e.g. either ``pkg.mod`` or ``..mod``). If the name is specified in relative terms, then the *package* argument must be set to the name of the package which is to act as the anchor for resolving the package name (e.g. ``import_module('..mod', 'pkg.subpkg')`` will import