On 28/04/15 02:35 AM, Oam wrote:

[...]

> How would I make it so it retrieves the TestPiece class for execution
> without having to manually create an object on the python side. What I
> really want is for the object to exist on the cpp side, but the python
> side is what is manipulating it's behavior.

The approach I typically use for this is the same in Python and C++:
After the script has been run, the "main_namespace" dictionary will
contain all the objects (including types) that the script added. Thus
it's possible to iterate over all the content and look for types that
are derived classes of "MagicEngine.BaseBehavior". Once you have those
you may instantiate objects of those types and operate on them in your
main application's runtime.
In that sense the python script really becomes a configuration file
rather than an executable script.

        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to