def get_input():
if msvcrt.kbhit():
return msvcrt.getch()
else:
return ''
def get_input():
global player_dir
player_dir = [0, 0]
inp = get_input() # INFINITE RECURSION, CALLS ITSELF
There is your problem. You have two functions called get_input
with matching signatures. Rename one of them, probably the first one to something like get_character
.