Calling a python function on a different thread #3976
-
Right now I'm creating an interface to create "hooks" on an application from python (which is basically just calling a function from my program whenever the target function is run). I've successfully created the hook and I'm saving the passed callback python function in an Traceback (most recent call last):
File "(filename)", line 7, in hook
print("from func")
TypeError: 'NoneType' object is not callable Here's how I'm calling it: py::gil_scoped_acquire guard{};
hookmap[__FUNCTION__](); The catch here is that it's always on the first line of the function that errors, even if I change it to something like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It's fixed now, the problem was the the interpreter was being destroyed before I called the function. |
Beta Was this translation helpful? Give feedback.
It's fixed now, the problem was the the interpreter was being destroyed before I called the function.