0

I am trying to write a python script which registers a function as a listener for certain events. However, by the time the listener callback function gets called, the python process has ended, since it is just a short script. What is the best way to keep the python process running so that the callback function can be run when it gets an update?

In case it is relevant, I am trying to do this to get state updates from a drone running ardupilot. Whenever the drone's attitude changes, I want my callback function to be run.

Thanks in advance for any help!

  • [How to pass and run a callback method in Python](https://stackoverflow.com/q/6800984/608639), [Python functions run as background processes](https://stackoverflow.com/q/35657681/608639), [Run background process in Python and do NOT wait](https://stackoverflow.com/q/37058013/608639), etc. – jww Feb 14 '18 at 06:30

1 Answers1

0

You can achieve that using a good while loop that updates your listener function so long as your set criteria evaluate to true.

Tungata
  • 625
  • 1
  • 6
  • 11