Hi have a problem with python and minecraft?

ar
1

Python should simulate a keystroke so that the Minecraft character runs. The keystroke is also simulated but nothing moves in Minecraft, someone can help me

import pyautogui
import time
screenWidth, screenHeight = pyautogui.size () # Get the size of the primary monitor.
currentMouseX, currentMouseY = pyautogui.position () # Get the XY position of the mouse.
time.sleep (10)
pyautogui.keyDown ('w');
print ("done")

Gr

Use pydirectinput instead of pyautogui. The functions are all exactly the same