Autoclicker help

How is it possible to make a fast hold LMB to autoclick LMB autoclicker in python

Main issue is cant differenciate simulated clicks from mouse clicks so the autoclicker cancels itself

i have already tried:
making “simulated clicking” variable while its doing a simulated clicks
This works pretty well but at high speeds its unreliable and breaks sometimes, cancelling the autoclicker
I have also tried making it wait until a simulated click is fully processed before setting the variable to false, also works pretty well but sometimes if i stop holding LMB while its on well it also breaks and doesnt cancel when i unhold LMB

So how is it possible to make that kind of hold to click autoclicker in python ? any libraries recommand? thanks for help

If on Windows take a look at GitHub - CodeOptimist/ahkunwrapped: Bundled and bridged AutoHotkey for full native code execution from Python.

You can use PyAutoGUI. Install it by running pip install pyautogui

Then call the pyautogui.click() function. For safety reasons, you can slam the mouse cursor to one of the four corners of the screen to stop the script. There is also a 0.1 second pause after all PyAutoGUI function calls. To disable this (not recommended) and have it click as fast as possible, you can run pyautogui.PAUSE = 0.