Utils
get_obj_from_string(import_string)
¶
Retrieves an object based on an import string.
The import string should specify the full path to the desired object, starting from the root module. This function dynamically imports the module and retrieves the specified object (which can be a class, function, or any other Python object).
PARAMETER | DESCRIPTION |
---|---|
import_string
|
The import string, which is a dot-separated string
representing the module path and the object name. For example:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
object
|
The object identified by the import string. |
RAISES | DESCRIPTION |
---|---|
ImportError
|
If the module specified in the import string cannot be found. |
AttributeError
|
If the object specified in the import string does not exist within the imported module. |
Examples: