Python: exchange object I got a .blend file where I got a simple cube and a plane. The Cube has some attributes like being a rigid body etc. 

Now I let this cube fall on to the plane and then render an Image. This is my code:

scene = bpy.context.scene
cam = bpy.data.objects['Camera']
obj = bpy.data.objects['Cube']

scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = '/path/testImage.png'
scene.render.resolution_x = 640
scene.render.resolution_y = 640

scene.frame_set(scene.frame_end)
bpy.ops.render.render(write_still = True)


I would like to exchange the cube-object with another object coming from an .stl file. So loading this stl object and having it instead of the cube but with the same attributes that I set to the cube and at the same position. 

How can I do this?
With help from @batFinger I derived this working solution:

import bpy
import os

scene = bpy.context.scene
cam = bpy.data.objects['Camera']
obj = bpy.data.objects['Cube']

scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = 'testImage.png'
scene.render.resolution_x = 640
scene.render.resolution_y = 640

# change mesh
path = r"assembly_upsampled.stl"
bpy.ops.import_mesh.stl(filepath=path)
obj.data = bpy.context.object.data
bpy.data.objects.remove(bpy.context.object)

# scale size
max_dim = 2
if obj.dimensions.length:
    obj.scale *= max_dim / max(obj.dimensions)

# render
scene.frame_set(scene.frame_end)
bpy.ops.render.render(write_still = True)