newbie to programming and had encountered an isue

the following code is not working and I don’t know why

def state_walk(self):    

        k = keyDown
        
        up_down = k(events.UPARROWKEY) - k(events.DOWNARROWKEY)
        right_left = k(events.RIGHTARROWKEY)- K(events.LEFTARROWKEY)
         
        delta = Vector((right_left, up_down, 0))
        delta.magnitude = self.speed
         
        self.worldPosition += delta      

heres the full code

from bge import logic, types, events
from mathutils import Vector


def keyDown(key_code, status = logic.KX_INPUT_ACTIVE):
    if logic.keyboard.events(key_code) == status:
        return True
    return False


def keyHit(key_code):
    return keyDown(key_code, logic.KX_INPUT_JUST_ACTIVATED)




class Player(types.KX_GameObject):
   
    def _init_(self, own):
        
        self.speed = 0.1
        
        self.main = self.state_walk
        
    #States
     
    def state_walk(self):
        
        k = keyDown
        
        up_down = k(events.UPARROWKEY) - k(events.DOWNARROWKEY)
        right_left = k(events.RIGHTARROWKEY)- K(events.LEFTARROWKEY)
         
        delta = Vector((right_left, up_down, 0))
        delta.magnitude = self.speed
         
        self.worldPosition += delta           
         
def main(cont):
    
    own = cont.owner
    
    if not "init" in own:
        own["init"] = True
        own = Player(own)
        
    own.main()

thanks for taking the time to read this… do respond if u have an idea

What messages are being printed on the console? If you are on Windows then you can select the menu option “Window->Toggle System Console” if you are on Linux for OSX then you have to open a terminal window then launch Blender from there to see the console output.

Any runtime errors that your scripts run into will be displayed in the console.

I noticed it says no module named ‘bge’