title: How can I on mac using python press keys in other applications?
body: <p>I looked around for the past day or so for some information on how to get my python script to work using pyautogui. I pretty much want it to press a button in a game to drive the car. It didn't work and I tried a couple of things like slowing down with the time module. and stuff. Then I tried it in a flash game on the internet and I worked fine. I was reading around and I found out pyautogui uses virtual keys which might be using a different way of input than the game I want to use  is used to. I found out I would have to use scan codes directly to get keyboard input. I found a script for that online on this website but it uses the window API. I've looked around for mac stuff to maybe create my own. A lot of the libraries I tried using didn't seem to work And i believe they used virtual keys. Can someone point me in the right direction with this?</p>
  
  <pre><code>import pyautogui
  import time;
  while True:
      pyautogui.keyDown('a')
      time.sleep(2)
  </code></pre>