In-Game color change via Python

Hey everybody

Is there a way to change the color of an object in the Game engine using Python? I tried now for a while to get it working, but with no success. I’m using object.color to change the color, but when I try:
object.color = Vector((1, 0.5, 0.5, 1))
nothing happens. Is there any other way to change the color of an object, or is it just impossible?

This is from the Tutorialsforblender3d.com.
color gets/sets the object’s color.

Type: float list [ r, g, b, a ] r = Red. Range: 0.0 to 1.0
g = Green. Range: 0.0 to 1.0
b = Blue. Range: 0.0 to 1.0
a = Alpha. Range: 0.0 to 1.0
Notes:
Object Color must be enabled.
Properties >> Material >> Options >> Object Color
Sample Code:
################## get the game object’s color

 # import bge
 import bge
 # get controller 
 cont = bge.logic.getCurrentController()
 # get object that controller is attached to 
 obj = cont.owner
# get the color
paint = obj.color
  
################## set the game object's color
  
 # import bge
 import bge
 # get controller 
 cont = bge.logic.getCurrentController()
 # get object that controller is attached to 
 obj = cont.owner
# set the game object's color
obj.color = [ 0.0, 0.0, 1.0, 0.5]
  

Thanks for the quick answer! It works now :smiley: