I don't see anything wrong there, assuming you have the input configured correctly.
What happens if you add a few print statements to the code?
print('inside input event')
motion.y += speed
motion.x += speed + flow
Which messages do you see when you run the code?