Ask a question to get started
Enter to send•Shift+Enter new line
Import an attribute from a module located in a package.
This utility function is used in custom __getattr__ methods within __init__.py files to dynamically import attributes.
__getattr__
__init__.py
import_attr( attr_name: str, module_name: str | None, package: str | None ) -> object
attr_name
str
The name of the attribute to import.
module_name
str | None
The name of the module to import from.
If None, the attribute is imported from the package itself.
None
package
The name of the package where the module is located.