run a python program on a new thread
<p>I have two programs
program1.py is like commandline interface which takes command from user 
program2.py has the program which runs the relevant program as per the command.</p>

<p>Program 1 has also has an quit_program() module
In our simple universe.. lets say I have just one command and just one program
So lets say...</p>

<p>program1.py</p>

<pre><code>def main():
   while True:
        try:

            command = raw_input('&gt; ')
            if command == "quit" :
                return

            if command == '':
                continue
        except KeyboardInterrupt:
            exit()

        parseCommand(command)
</code></pre>

<p>And then I have:</p>

<pre><code> if commmand == "hi":
       say_hi()
</code></pre>

<p>Now program2 has </p>

<pre><code>   def say_hi():
      #do something..
</code></pre>

<p>Now there can be two cases...
Either say_hi() completes in which case no issue...
But what i want is that if user enters a command (say: end)
then this say_hi() is terminated in between..</p>

<p>But my current implementation is very sequential.. I mean I dont get to type anything on my terminal untill the execution is completed..
Somethng tells me that the say_hi() should be running on another thread?</p>

<p>I am not able to think straight about this.
Any suggestions?
Thanks</p>
