How can I get the angle of the YAW axis in lua scripts

I am writing a lua script for my VTOL Tailsitter
How can I get the angle of the YAW axis, the problem is that when I use ahrs:get_yaw() then I get the angle relative to the airplane modes, not the modes