Two way communication between a python class and a C++ class

Donn Cave donn at
Fri Nov 9 00:10:05 CET 2001

Quoth Firestar <dwjoker at>:

| I am having a problem obtaining two way communication between a python
| class and a c++ class. I can get a python class to communcate with a
| c++ class and a c++ class to communicate with a python class, but i
| cannot seem to get the communication to go both ways.
| i.e I have a class CTest in c++ and a class PTest in python and when i
| create an instance of CTest in c++ it creates an instance of PTest in
| python, i then want PTest to be able to call methods in the instance
| of CTest that created the instance of PTest. How can i do this? there
| seems to be no way to pass the c++ pointer into the python class in
| the constructor...

The closest I have come to this is an approach like the one described

It doesn't work exactly like you describe - at least in mine, neither
class is created by other, nor would that be useful.

You may also find something interesting at

	Donn Cave, donn at

More information about the Python-list mailing list