I want to async not only call the cpp functions in Python but return Python functions in my cpp functions to make callbacks.

Example

python script import ffi import exemplecpp def hello(): print("Hello world\n") hello_callback = ffi.callback("v", hello, "") exemplecpp.cppfunc(hello_callback) 

How in the usermodule to retrieve the callback as a function to use it in my cpp function

cpp function mp_obj_t cppfunc(mp_obj_t func_obj) { ... func_obj(); ... return mp_const_none }