I created a python file that creates a thread calling functions from two different files
import objDetection_heartbeat
import combindedsensors
from threading import Thread
threads = []
sensors_thread = Thread(name="Sensors", target=combinedsensors.ping)
threads.append(sensors_thread)
sensors_thread.start()
heartbeat_thread = Thread(name="Heartbeat",
target=objDetection_heartbeat.heartbeat_send)
threads.append(heartbeat_thread)
heartbeat_thread.start()
heartbeat_send function is sending out a message every 5 seconds. combinedsensors.ping calculates the distance between two objects.
The python thread file I created only calls the heartbeat function. I see that coming through every 5 seconds, but I dont know why it isn't calling sensor_thread. It seems I can run one or the other, but not both. The reason I'm creating a thread is because the heartbeat is on an interval and instead of having to wait 5 seconds, I was attempting to call the sensor function in parallel with the heartbeat.