Apply physics to multiple objects using script I'm trying to apply physics properties to multiple objects using following script:   

for obj in bpy.data.objects:
     bpy.ops.rigidbody.object_add(type='ACTIVE')


but physics is applied only to the last object. Do you have any suggestions? I know how to copy physics using 'Copy from Active' but i need script.
Setup one object as template then the following code will set the template object as active object and select all objects. Finally bpy.ops.rigidbody.object_settings_copy() copies all attributes as the 'Copy from Active' button would do.

import bpy

scene = bpy.context.scene
scene.objects.active = bpy.data.objects["template"]  
for obj in scene.objects:
    if obj.type == 'MESH':
        obj.select = True


#bpy.ops.object.constraints_copy()
bpy.ops.rigidbody.object_settings_copy()