In your module, wscriptyou can use the standard atexit Python library to register the calls you want to call when the process exits. For instance:
import atexit
import time
class MayBeep(object):
def __init__(self, deadline=10.0):
self.deadline = time.time() + deadline
def __call__(self):
if time.time() > self.deadline():
print '\7'
atexit.register(MayBeep())
... rest of your wscript module ...
, - , print '\7' ( , , Python ), Q - , ".