Python bindings question

Hello everyone,

I need to add a C++ “proxy” class in OpenCV that will:

Internally call methods defined by the Python user.

Externally expose methods that the Python user can call.

I’m torn between two options:

Implementing the proxy in its own .cpp/.hpp files, separate from the bindings.

Defining it directly inside the pyopencv_.hpp binding file.

Which approach works best in practice for clarity, maintainability and build times? Any pointers or examples would be greatly appreciated!

Thanks!

I have no experience with this. Perhaps you could look at how the highgui callback setters do it, or rather, how the bindings generation code adapts these. mouse and trackbar callbacks can be set, and the library will call the given python functions that were passed.