BackgroundWorker.instance_by_component

classmethod BackgroundWorker.instance_by_component(ghenv, long_running_function=None, force_new=False)[source]

Get the worker instance assigned to the component.

This will get a persistant instance of a background worker for a given component. The parameter force_new can be set to True to request a new instance to be created.

Parameters:
ghenvGhPython.Component.PythonEnvironment

Grasshopper environment object

long_running_functionfunction, optional

This function will be the main entry point for the long-running task.

force_newbool, optional

Force the creation of a new background worker, by default False.

Returns:
BackgroundWorker

Instance of the background worker of the current component.