To stay flexible while weight training, take each movement through its full range of motion.
This is with free weights, of course. People that read this understand that machines are garbage. If you are new to this blog, read my post about how bad machines are.
So when you are back squatting or overhead pressing, take the joint through as much rotation, flexion, and extension as possible. When pulling up or lunging forward, bend and straighten your joints as far as you can.
Another benefit to moving through a full range of motion is injury prevention. You lift less weight when moving a long distance. This prevents overloading the joints. I see this happen with back squats. Guys will put on a lot of weight and squat maybe 6.” This causes excessive pulling around the joint. And it’s bad form to squat nothing less than ass to grass.