How to control tcp position and angle independantly in Python?

Hi, I am developing a liquid pouring system with UR10. For that purpose, I want the robot to follow the pre-defined TCP trajectory, and at the same time, I want to control the angle of the cup with feedback from sensors, by changing the TCP angle.

Is there any good way or useful libraries to implement it?