title: How to move aim in games by using Python
body: <p>I'm trying to create an AI that plays CS:GO. </p>
  
  <p>But I could not move aim.</p>
  
  <p>I tried pyautogui, win32api, pynput libraries, all of them worked on desktop or anywhere that have an cursor.</p>
  
  <p>But in game there is no cursor and as I followed position of mouse is stay at middle ((1920/2, 1080/2), for me) when move mouse to turn it increases for a short time then backs to that position.</p>
  
  <p>How can I move aim in CS:GO or GTAV or anygame by python. what is the difference between python code and real mouse?</p>
  
  <p>I do not think this is because of anti-cheat because it did not worked on GTAV</p>
  
  <p>I looked same topics but they did not solve my problem</p>
  
  <p>Codes where similar for all libraries so the code that I used is this:</p>
  
  <pre><code>import pyautogui, sys
  import _thread
  import time
  
  time.sleep(2)
  
  def kaydir(miktarX, miktarY):
      pyautogui.moveRel(miktarX, miktarY)
  
  print('Press Ctrl-C to quit.')
  try:
      while True:
          x, y = pyautogui.position()
          positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
          print(positionStr, end='')
          print('\b' * len(positionStr), end='', flush=True)
          _thread.start_new_thread(kaydir, (1, 1))
          time.sleep(0.08)
  except KeyboardInterrupt:
      print('\n')
  </code></pre>