Is it possible to add qt widgets from a cmodule to a pyqt or pyside class?

For example if I have a widget MyWidget in mytest.so,

from pyqt import *
import mytest

widget = mytest.MyWidget() # C++ qt widget
window = QtGui.QMainWindow()
window.setCentralWidget(widget) # put C++ widget in pyqt widget

window. show()

This will cause a type error trying to add widget to the window. Is there something I can do to the widget on the python-side or C++-side that will allow this to work?