Skip to main content

import_string

Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed.

def import_string(
dotted_path: string
) - > any

Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed.

Parameters

NameTypeDescription
dotted_pathstringThe full Python path to a module and its attribute, separated by dots (e.g., 'package.module.ClassName')

Returns

TypeDescription
anyThe attribute or class designated by the final component of the dotted path