You should get it to work with this loop (from run()): while libbuf != "quit": lib.libCallCommand(libinf,libbuf,0,pointer(result)) print "result: ",result.value if libbuf == "Exit": break libbuf = raw_input("lib>")