Class attributes lost when extending Python interface

Hello everyone.

I’m implementing a custom PythonDragSensitive model (let’s call it MyDragSensitive), and when doing so, at construction, I pass the area and store it in the object to later use it in the computation of the acceleration. Everything up until here works just fine.

At a later stage I want to retrieve my custom object from the DragForce instance that I get from my propagator. However, when doing so, what I obtain from getSpacecraft is a generic PythonDragSensitive object, which doesn’t allow me to access the area attribute of the MyDragSensitive instance.

I tried casting it to MyDragSenstive, but of course this uses the cast_ method from the interface, therefore it still returns a PythonDragSensitive object. Any suggestion on what I can do?

Hm hard to say. I checked and cannot see any obvious issue in the PythonDragSensitive implementation. Not sure I understand, but as a workaround, if you have an instance of MyDragSensitive can’t you keep it as a python object and then use it later? I am not sure that it would work to “create” a python object out of an object returned from java.

The problem is that I don’t have a reference to the initial instance of MyDragSensitive, since it’s used when building the propagator (I have a function that takes care of that). Changing it would mean changing a lot the architecture of my codes…

At the moment the workaround I found is to put the area as a ParameterDriver. This seems to allow me to modify it whenever I want.