import threading from service.producer import run_kafka_producer def start(): kafka_producer_thread = threading.Thread(target=run_kafka_producer) kafka_producer_thread.start()