I need to send a series of steering wheel input : (steering wheel, accelerator, brake) that is calculated in Machine learning Model to a game in order to implement self driving. I have already used pynput to send keys and control the car with ['w','a','s','d'] but I want a smoother way to control the car, hence I'm looking for a way to emulate a joystick in python. So, that I can send analogue input for steering wheel and accelerator.
I previously used this type of code to input controls
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
keyboard.press('w')
time.sleep(1)
keyboard.release('w')