Making a linked duplicate while preserving the rigidbody


When you do shift+D the rigidbody is copied, I read that you shouldn’t use “bpy.ops.object.duplicate” and that in a script you should use :

scn = bpy.context.scene
new_obj = obj.copy() = # not copying data make the new object linked

this does indeed create a linked duplicate but it does not duplicate the rigidbody, I tried adding :

new_obj.rigid_body = obj.rigid_body.copy()

But this line raises : AttributeError: ‘RigidBodyObject’ object has no attribute ‘copy’

How do you guys do it?