how do I make a fork or non-blocking system call in python
Question: This is related to [this
question](http://stackoverflow.com/questions/204017/how-do-i-execute-a-
program-from-python-os-system-fails-due-to-spaces-in-path) but with a
different take.

In Ubuntu, I use Autokey, which uses python to automate keystrokes it
observes. So I have `<super>+e` mapped to open Gedit, `<shift>+<super>+3` to
open OOwriter, etc etc. When I make one of these calls, I cannot make another
one until the previous program called has exited.

Here's a sample of the script it executes:

    
    
    import subprocess
    subprocess.call("/opt/openoffice.org3/program/scalc")
    

... same behavior using:

    
    
    import os
    os.system("/opt/openoffice.org3/program/scalc")
    

This all worked smoothly in my previous Ubuntu 10.04LTS, but things have
changed since then and I can't repeated make these calls.

**Would you please help me with how to fork or do something to "get back" from
that subprocess.call() without waiting for the program to exit?** I tried
nohup and backgrounding `/opt/openoffice.org3/program/scalc &` but those do
nothing (probably breaks something in Autokey and Py)

* * *

**Answer:** the answer below didn't actually work, but got me snooping around
more and I found another [SO
answer](http://stackoverflow.com/questions/1613713/in-python-how-can-i-do-a-
non-blocking-system-call) which did work for my situation!

    
    
    #Enter script code -- mapped to <super>+e
    import thread
    thread.start_new_thread(os.system,('gedit',))
    

This totally worked!! I can hit `<super>+e` 2 or 3 times in a row and it keeps
adding tabs to gedit. :) This script makes Autokey act as though the command
in quotes is typed at the command line.


Answer: It's as easy as using `Popen` instead of `call`:

    
    
    import subprocess
    subprocess.Popen("/opt/openoffice.org3/program/scalc")
    

`call` should never have worked that way since it has to return the exit code,
meaning the program would actually have to exit.

