Sometimes the best way to perform complex behavior in a callback is to put that behavior into an external script which can take the job ID as an argument.
The following is an example of a callback that runs for every frame when the job completes. Â Admittedly, it may be more efficient to run it once and have the external script iterate over every frame, but this is for demonstration purposes.