Programm doesnt work after Reset

Hello, I’ve been sitting on this problem for days and can’t find a solution.
I dont understand the Errormessages, please help… Thanks a 1000x times

I am creating parts with a component creator in a component container and unloading them from it with a robot.

Creator:
creator250 = comp.getBehaviour(“ComponentCreator250”)
creator250_output = creator250.getConnector(0)
ComponentContainer_1 = comp.getBehaviour(“ComponentContainer_1”)
ComponentContainer_1_input = ComponentContainer_1.getConnector(0)
creator250_output.connect(ComponentContainer_1_input)
part1 = creator250.create()
delay(0)

Robot:
global part
part = P1.HeadComponent
delay(0.1)
robot.jointMoveToComponent(Part,Tx=0,Ty=0,Tz=100,Ry=0)
robot.linearMoveToComponent(Part,Tx=0,Ty=0,Tz=0,Ry=0)
robot.graspComponent(Part)

When I open the simulation and press start everything works.
As soon as I reset and restart I get the following error messages:

in jointMoveToComponent
statement = doRSL(self, VC_STATEMENT_PTPMOTION, robotMove)
in doRSL
readFromTarget(robo, robotMove, statement)
in readFromTarget
position = statement.Positions[0]
ReferenceError: Object no longer exists.

How can I fix this?

Translated with DeepL Translate: The world's most accurate translator (free version)

My guess is that something deletes the statement object on reset or otherwise, so you will need to get it again before trying to use it.

It might get replaced with an identical object, but your variable would still point to the old deleted one.

Did you manage to get this problem solved?
I’m running into a very similar issue;

While trying to pick a part from a path;
image

If i change a small thing in my python code (i.e. add a # randomly somewhere) the simulation works again, and then after resetting I’m running into the same issue.

Can anyone help me with this?

I guess something deleted the statement on the other side, could you upload the simplified layout?

1 Like

Fortunately I just got the error fixed by moving the ‘getRobot’ statement into the OnRun() part rather than the start of my Python script. Somehow this did the trick

Thank you offering help idkfa!