Hi @feepyj,
You need the formulas for a “tilt compensated compass”.
These links will get you started.
https://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf
The tilt compensated compass only works while Reach is static. If you what the orientation of Reach while dynamic then you will need to use one of the more complicated sensor fusion libraries like this one (GitHub - micropython-IMU/micropython-fusion: Sensor fusion calculating yaw, pitch and roll from the outputs of motion tracking devices).