bec_lib.plugin_helper.get_plugin_class#

get_plugin_class(class_spec: str, additional_modules=None) type[source]#

Load a class from a plugin module. The class specification should follow the syntax <package>.<module>.<class> and is thus equivalent to the import statement from <package>.<module> import <class>. Imports along the lines of from <package> import <class> are also supported, assuming that the class is residing in the __init__.py file of the package.

Parameters:
  • class_spec (str) – The class specification.

  • additional_modules (list) – Additional modules to search for the class.

Returns:

The class object.

Return type:

class

Raises:
  • ValueError – If the class specification is invalid.

  • ModuleNotFoundError – If the module could not be found.