using a Python callback for sim.collision_resolve seems to be working, but there is one usability issue: It seems like Pyhton Exceptions are ignored and the program continues as if nothing happens.
The Python FFI module provides an interface to call C functions from Python, and to create Python callback functions that can be called from C. It can be used to interface with Fortran as well, ...