'Is it possible to create a python type in pythonnet python.net? (similar to PyTypeObject and PyModule_AddObject in c++)

I am trying to replicate some C++ code which using PyTypeObject and PyModule_AddObject to create a python types.

static PyTypeObject gXPythonPropertyType =
{
    PyVarObject_HEAD_INIT( NULL, 0 ) "x.Property", // tp_name
    sizeof( xPythonProperty ), // tp_basicsize
    0, // tp_itemsize
    xPythonPropertyDealloc, // tp_dealloc
    ....
}

PyModule_AddObject( Module, "Property", ( PyObject* )&gXPythonPropertyType );

Is it possible to do a similar thing in Python.net? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source