Script keeps stopping

Hi
I have a script that controls a Sony RX100 using a Seagull #REC2, a Gremsy Pixy U through a Herelink.
The script works fine i.e. controls the gimbal and camera functions but after a short period of airtime the script stops working and turns the camera off and I have to land and repower everything to get it started again. Today it shut down after about 2.5 minutes and again after about 30 seconds on another flight.
Is there a way to find in the logs to see what is happening or does someone have a fix for this e.g. restart the script in the air? I did notice someone was working on a parameter that restarted scripts but it doesn’t seem to have been implemented?
I have SCR_HEAP_SIZE = 150,000. It may be a memory problem but not sure how much is needed??
Here is a link to the script.
https://drive.google.com/file/d/1dcFnQQs32xWQ9MvMOR_bhkXWJrp5eNK6/view?usp=sharing
Any help would be appreciated!!
Peter

Scripting will give a message if a script stops due to a error, they will be in the log (if you were logging when they stopped) You can also set SCR_DEBUG = 2 for a message each time the script is run.

Thanks and I will try i. Do you have any suggestions on the SCR_HEAP_SIZE I should use?