How to get part instance from gripper?

My robot grips a part. I need to get a reference to this gripped part in the robot’s python script.
As in
part = comp.XXXXX.

Any ideas how to do this ?

Thanks and best regards,

If you used a signal action to grab a part then the snippet below is a quick and dirty way that should work. It relies on the fact that ecat robots have a component container called “GraspContainer” which is used to store a part when you use grasp action.

cont = comp.findBehaviour('GraspContainer')
part = cont.Components[0]