I guess your flashlight moves independently of your player? Usually you would keep the flashlight locked to the camera and the camera is usually locked to the player’s forward axis(though x axis is made independant to look up and down). But you may be doing things differently so…
To get the angle between the two, you need the vectors corresponding to your desired axis.
The player’s Y+ axis vector is
Use the same method to get the flashlight’s forward vector. Depending on how you built the flashlight, forward would be [1,0,0] if X+ is forward, [0,1,0] for Y+, [0,0,1] for Z+.
When you have the two vectors, you get the angle with
angle = vector1.angle(vector2)
This returns in radians. If you’re more comfortable with degrees, you will have to import the math module -
import math and use the degrees() method
angle = math.degrees(vector1.angle(vector2))
There may be much simpler ways to do this but it all depends on how you have constructed your player-flashlight hierarchy. There’s no one right way to do it but most of the time there are more efficient ways to do it that will save CPU/GFX resources.