Run python object in C++

Viewed 238

I just have a question about running a python object in C++. Let me explain what I want to do in the following example.

int main () {
    // as you know, the python object has its member variables etc, and 
    // I want it to be initialized only once
    py = python_object();   
    while (1) {
        // here, I am hoping to call a member function from the object continously
        // and get a return value. 
        int abc = py.get_num(); 
        if (abc < 0) break;
        do_something_in_my_cpp_code();
    }


}

The python object that I was talking about this here Capture oOjbect.

I am wondering how difficult would this be, if you guys have any experience of dealing with things like this. I am also open to other possible methods, such as the reverse (running a C++ object inside a python script).Thanks!

1 Answers
Related