title: Boost.Python - Passing boost::python::object as argument to python function?
body: <p>So I'm working on a little project in which I'm using Python as an embedded scripting engine. So far I've not had much trouble with it using boost.python, but there's something I'd like to do with it if it's possible.</p>
  
  <p>Basically, Python can be used to extend my C++ classes by adding functions and even data values to the class. I'd like to be able to have these persist in the C++ side, so one python function can add data members to a class, and then later the same instance passed to a different function will still have them. The goal here being to write a generic core engine in C++, and let users extend it in Python in any way they need without ever having to touch the C++.</p>
  
  <p>So what I thought would work was that I would store a <code>boost::python::object</code> in the C++ class as a value <code>self</code>, and when calling the python from the C++, I'd send that python object through <code>boost::python::ptr()</code>, so that modifications on the python side would persist back to the C++ class. Unfortunately when I try this, I get the following error:</p>
  
  <p><code>TypeError: No to_python (by-value) converter found for C++ type: boost::python::api::object</code></p>
  
  <p>Is there any way of passing an object directly to a python function like that, or any other way I can go about this to achieve my desired result?</p>
  
  <p>Thanks in advance for any help. :)</p>