import threading from service.test import test def run_kafka_spark(): print('run_kafka_spark') t1 = threading.Thread(target=test) t1.start()