[C++-sig] Instance access
Renji Panicker
renjipanicker at gmail.com
Mon Nov 24 09:19:59 CET 2008
Try this:
main_namespace["instance"] = boost::python::ptr(this);
Assuming you have exposed the class to python, of course.
-/renji
On Mon, Nov 24, 2008 at 10:20 AM, fileoffset <fileoffset at gmail.com> wrote:
>
> Is it possible to access an object instance from within python?
>
> I am trying to automate a single class that is part of a larger, complex
> framework. My idea is that I could load an embedded python script on
> construction of the object, which would act on the 'this' or
> 'shared_from_this()' pointer. This would greatly simplify my automation.
>
> I have tried it myself but it doesn't seem to work:
>
> main_namespace["instance"] = this;
>
> Is that ever going to work like I would want/expect? Or is there an
> alternative or work around that I could use?
>
> Please help! Any information is appreciated
>
> --
> file offset <fileoffset at gmail.com>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
More information about the Cplusplus-sig
mailing list