Search code examples
pythonsynchronizationpi

python run sevral codes at same time


is there any way I can run python code in this way:

main code will run all the time , once every 5 min will run another function while running the main code.

my code is reading gps signal and send it to my server every 5 seconds.

I have to run another code that check the device cpu\file\temp every 5 min (this part take around 30 seconds ) can both of them run at the same time while still getting gps?

I have the GPS code ready and also the Check code ready - how do I combine them (if it's possiable)

Thanks ,


Solution

  • This might answer your question: Running Two Script at Once Using Bash

    Based on the answer here, all you'd have to run is:

    python script1.py &
    python script2.py &