Making a linked duplicate while preserving the rigidbody

Hi,

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()
#new_obj.data = obj.data.copy() # not copying data make the new object linked
new_obj.animation_data_clear()
scn.objects.link(new_obj)

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?

Thanks.