Pygame : problem with calculating an angle between two points

I've been struggling to calculate the angle alpha between an object and a certain point M so that I can move that object to M.

To calculate alpha, I'm using trigonometry and more precisely the atan2 function from the python math module :

class Obj:
...
@property
def alpha(self):
return atan2(self.center[1] - my, self.center[0] - mx)


The problem I'm struggling with is that alpha, the calculated angle is not accurate. Take a look at this image :

So as the representation shows, in a situation where the obj and the point M are aligned, and that obj is on top of M, alpha is equal to 90 degrees !!

I can't understand why this happens. I know in math that a straight line is 180° or pi radians but not 90° !

Furthermore, if the point M was situated on top of the object on the screen, alpha will be negative.

What I want to do, is to suppose that the center of the obj is center of an 'imaginary' circle. Then, calculate the angle between the obj and M just like the image below shows :

This means that I want alpha to be equal to zero degrees if M is on the right of the obj forming a horizontal line, and I want it to be equal to 90° if M is on top of the obj forming a vertical line and so on ..

The problem turned out to be caused by flipped values in the atan2 function's parameters.
atan2(self.center[1] - my, mx - self.center[0])