Is there a way to get HA to control a Servo On Rpi4?

i have HA on a RPi4 with a servo… and a momtary switch…
is there a way to get HA to turn on and off the Servo within HA
and be able to press the Button and the Servo only turns 45 or 90 degrees?

or do you have to run a python script to turn the servo? or do you need it running on a Arduino and the Raspberry Pi simulates button press on the Arduino

what are the options i was hoping 1 board