Callback Executor
The Callback Executor allows you to execute an automation function and trigger a callback function upon completion.
Basic Usage
from je_auto_control import callback_executor
result = callback_executor.callback_function(
trigger_function_name="screen_size",
callback_function=print,
callback_param_method="args",
callback_function_param={"": "Callback triggered!"}
)
print(f"Return value: {result}")
How It Works
The
trigger_function_namefunction executes first.After it completes, the
callback_functionis called.The return value of the trigger function is returned after all callbacks finish.
Parameters
Parameter |
Description |
|---|---|
|
Name of the function to execute (must exist in |
|
The function to call after the trigger function completes |
|
Parameters to pass to the callback function (dict) |
|
|
|
Additional keyword arguments passed to the trigger function |
Extending the Callback Executor
Load external package functions into the callback executor:
from je_auto_control import package_manager
# Add all functions from the 'time' module
package_manager.add_package_to_callback_executor("time")
To inspect the current event dictionary:
from je_auto_control import callback_executor
print(callback_executor.event_dict)
Note
The callback executor’s event_dict should contain the same function mappings as the
main executor. If they differ, it is a bug.