sc4py.klass module

sc4py.klass.instantiate_class(full_class_name: str, *args, **kwargs) object[source]

Dynamically instantiates a class from a dotted path string.

Parameters:
  • full_class_name (str) – The full dotted path to the class (e.g., ‘package.module.ClassName’).

  • *args – Positional arguments to pass to the class constructor.

  • **kwargs – Keyword arguments to pass to the class constructor.

Returns:

An instance of the specified class.

Return type:

object

Example::
>>> instance = instantiate_class('collections.Counter', 'abc')
>>> type(instance)
<class 'collections.Counter'>