#include using namespace boost::python; class Base { public: virtual int f() = 0; }; int call_f(Base& b) { return b.f(); } class BaseWrap : Base { BaseWrap(PyObject* self_) : self(self_) {} int f() { return call_method(self, "f"); } PyObject* self; }; BOOST_PYTHON_MODULE(test_module) { class_("Base", no_init) ; def("call_f", call_f); }