How to change object scale in bge via the arrow keys? So I'm trying to scale up and down a cube using the arrow keys.
I've tried with this code (I'm not too good in Python so I used a template, and I'm not pretty sure if it's the correct one):

import bge


def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner
    sens = cont.sensors["pixelscale"]
    pixel ["scale"] = bpy.data.objects["pixel"].scale[0]

main()


By the way, this is the logic bricks set up



What do I have to change?
First you should never use bpy with bge.

Your script should look like:

import bge


def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner
    pixUp = cont.sensors["Keyboard.001"]
    pixDown = cont.sensors["Keyboard"]
    factor = 1
    if pixUp.positive:
        own.localScale[factor]*3 # the same as own.localScale[1,1,1]
    if pixDown.positive:
        own.localScale[factor-1]*3 # the same as own.localScale[0,0,0]
main()