How to get the angular position of a the rotating object of a motor constraint in python scripting during animation play ? (Blender 2.78) I have a simple scene with a motor and its shaft on which a spool is attached.
The animation works, the shaft is rotating and I can control its value from python using :

bpy.data.objects['Constraint.motor'].rigid_body_constraint.motor_ang_target_velocity = 0.5


It must be possible to get the actual rotation (angular position) of the shaft, but when I do :

bpy.data.objects['Spool'].rotation_euler


it only gives me the Euler angles at keyframe 0, but not the actual value as the animation is being played.
Is their a way to access this value ?

The final goal is to simulate a motor encoder for a robotics simulation.
Thanks !
The Object's matrix_world is what you're after. Call to_euler(...) to get the Euler angles.

bpy.data.objects['Spool'].matrix_world.to_euler('XYZ')