# set mass of objects via python?

I'm scripting this file that generates an environment containing objects of different masses, shapes, sizes and physics types. I'm having trouble setting the mass, though...

e.g.

bpy.ops.mesh.primitive_plane_add(location=(0,0,-20))
plane = bpy.data.objects["Plane"]
plane.scale=((200,200,200))
plane.game.physics_type = 'STATIC'
plane.static.mass = 20


^^^plane.static.mass doesn't work and neither does plane.mass. How do I do this/get it to also work for rigid body and soft body objects?

First let's clarify your use case, you are setting plane.game.physics_type so you may want to set the matching plane.game.mass both of which are only relevant for the game engine physics.
If you are using the interactive physics available in the 3Dviewport then you will want to use plane.rigid_body.type and plane.rigid_body.mass