I have a circuit for a 12v dc motor with a battery and a PWM controller. the system sort of is in this order battery-->PWM-->motor. I want to add in a switch to reverse the polarity to switch directions of the DC motor at will. Without the PWM, its a pretty simple operation and straightforward, but I was wondering how to do it now with the PWM. Do I put the switch after the pwm before the motor or between the battery and pwm? I wasn't sure how the PWM would affect the system direction and didnt want to ruin anything in my system while implementing the new switch
There are a few ways of doing this, but the easiest is the one to insert a DPDT relay in line with the motor.
Depending on the polary of the output, you might need to connect VCC instead of GND on the contact of the Relay, but the concept remains the same.
With a simple switch or a GPIO you can drive the relay and change the direction
Consider replacing the motor controller entirely with a H-bridge controller. A H-bridge is a motor controller that allows you to control speed with PWM and change direction with 2 digital IO pins.
The L298 is a popular one, plenty of modules available for cheap. You can control 2 DC motors with it.