Hi

My problem is the following line in the code below:
"parent p = (parent)(PyO.__tojava__(parent.class));"

Which doesn't work, because PyO technically isn't an instance of parent and thus returns the Py.NoConversion object...

So I would like to know if it is at all possible to typecast a PyObject defined by a Python class which inherits from a java class, back to the original java superclass.

test.java

public class test
{
    public static abstract class parent
    {
       abstract public dosomthing();
    }

    public static void main(String[] args)
    {
       PythonInterpreter interp =    new PythonInterpreter();
       
        interp.execfile("inherit.py");
        PyObject PyO = interp.get("PyO");

       parent p = (parent)(PyO .__tojava__(parent.class));

       p.dosomething();
    }

   
}

inherit.py
import test;
from java.lang import *
class child(test.parent):
    def dosomething(self):
       System.out.print("did something")

PyO = child()