How to change an object's material or texture with python script in blender game and for it to be visible?
bpy is the main blender module, it is not available inside the game engine where you should start your scripts with import bge. In the game engine you use different data structures than the main part of blender. I don't think the bge let's you easily change materials, this page makes it sound like you need to loop over every poly to change the material.

There is a simple way to achieve what you want, using logic bricks to swap mesh objects. First step is to check you have the material linked to the data not the object, data is the default setting so may already be set.



Then duplicating the object and giving the second one the other material. Then you can use an Edit Object actuator to swap meshes.