Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading
- import subprocess
- import os
- import sys
- class subprocess_thread(threading.Thread):
- def __init__(self, filename):
- threading.Thread.__init__(self)
- self.filename = filename
- def run(self):
- FNULL = open(os.devnull, 'w')
- cmd = subprocess.Popen(['python', self.filename, '&'], stdout=FNULL, stderr=FNULL, shell=True)
- cmd.communicate()
- cmd.kill()
- script_thread = subprocess_thread('test.py')
- script_thread.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement