Callback Function API

The Callback Executor runs a trigger function and then invokes a callback.


callback_function

callback_executor.callback_function(trigger_function_name, callback_function, callback_function_param=None, callback_param_method='kwargs', **kwargs)

Executes a trigger function from the event dictionary, then calls a callback function.

Parameters:
  • trigger_function_name (str) – Name of the function to trigger (must exist in event_dict).

  • callback_function (callable) – Function to call after the trigger completes.

  • callback_function_param (dict) – Parameters for the callback function. Pass None for no parameters.

  • callback_param_method (str) –

    How to pass parameters to the callback:

    • "args" – unpack as positional arguments

    • "kwargs" – unpack as keyword arguments

  • kwargs – Keyword arguments passed to the trigger function.

Returns:

Return value of the trigger function.

Example:

from je_auto_control import callback_executor

def on_complete(width, height):
    print(f"Screen size: {width}x{height}")

result = callback_executor.callback_function(
    trigger_function_name="screen_size",
    callback_function=on_complete,
    callback_param_method="args"
)