I'm looking for a way how to create an instance of a class written in python and call it's methods from c++. If available, I'd prefer to incldue the boost python libraries. I imagine to have a class in python like
class MyPythonClass(object):
def __init__(self, first_var):
self.__varToStore = first_var
def method_to_call(self, list_of_input = []):
### some manipulation
return 42
I've already found lot's of threads, how to import the python module in c++ using the python libraries and may-be I've found a way how to create an instance of the class.
boost::python::object mylib = boost::python::import("MyModule");
boost::python::object my_class = mylib.attr("MyPythonClass");
But from that point, I'm just stuck. How can I create an instance of the class and call its method?
Thanks