Change Motion Actuator Properties with Python?

Hello! I was wondering if it was possible to change the properties of a motion actuator, for example the speed that affects an axis movement, with a python script connected to that actuator. If so, can anyone tell me how I can do this?

Yes you can


import bge

cont = bge.logic.getCurrentController() 

act_move = cont.actuators['Move']
act.move.linV = [ 0, 0, 4.0 ]

I also want to do something like this:
I have the character that, if it eats some fruits, it walks faster, but if it eats others, it walks slower.
I thougt I could set a velocity property and increase or decrease its value. Then, use this value to determine the character’s velocity. But how to use the property in a motion actuator?

And where to put this code below?