I'm trying to make it so that whenever I move the black circle on the left outside of the blue line, it teleports it back inside of the blue line. The blue line is the polygon. I'm pretty much a beginner in Pygame, so if anyone knows, thanks for the help.
The blue is the polygon:
I tried using a bunch of if statements, to move the circle back in, and I thought it would have worked, but I realized that the corner for the little hole on the top would cause some problems.