Im currently trying to embed the python interpreter into my application. Because my application uses the Poco API for logging, I want to make it accessable through the logging module in python too. The most easiest way for me to do this, is to provide a static set of function as an extension module to log a message and then to write a Handler subclass calling these functions.
Since I dont want the user to install any additional python modules and since I dont have the requirement to reuse my code outside of my embedded python interpreter, it would be great if one could just provide the static functions through Py_InitModule() and then to add a hardcoded Handler subclass to the created module (hardcoded means: added at runtime but actually a const string which gets always interpreted at initialization).
My problem is that I dont know how to interpret a normal python class definition, e.g:
class Test:
someVar=1
so that it is added to a given module and then accesable as, e.g mymodule.Test
A solution can either be pure python based or work with the python c-api.