import pyvisit
g = pyvisit.Graph()
g.addNode(3)
g.addNode(5)


class PyNodeVisitor(pyvisit.NodeVisitor):

    def OnNode(self, node):
        print(node.getN())
pnv = PyNodeVisitor()
g.accept(pnv)
How to pass Python instance to C++ via Python/C API