import imp import thread import time pymain = imp.load_dynamic("pymain", "./pymain.so") def run(fun): thread.start_new_thread(fun, ()) print "out" def f2(): while(True): print "." time.sleep(1) def tfun(): pymain.py_main("a", "b", "c")