title: Run python object in C++
body: <p>I just have a question about running a python object in C++.  Let me explain what I want to do in the following example. </p>
  
  <pre><code>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 &lt; 0) break;
          do_something_in_my_cpp_code();
      }
  
  
  }
  </code></pre>
  
  <hr>
  
  <p>The python object that I was talking about this here <a href="https://github.com/alexa-pi/AlexaPi/blob/master/src/alexapi/capture.py" rel="nofollow noreferrer">Capture oOjbect</a>.</p>
  
  <p>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!</p>