Obviously double check with your doc about this, but perhaps you can take the medications you have to take outside of your eating window with a very low calorie meal, like plain salad and/or veggies. You’ll should be able to reap most of the benefits, especially if your goal is weight loss. It’s still CICO at the end of the day. Those medicines are essential after all and if you are able to take it with plain veggies, that is probably the best balance.
Talk to your doctor. Don’t live by advice here when it is life critical medication that we know nothing on the scenario. Talk to them about IF and see what they think about tweeking your medication times to fit the schedule you desire.
I would try alternate day fasting in this case with the fasting day having 500 or less cal. But obviously it depends on the medication and your conditions. Especially if they impact blood sugar or blood pressure.Edit: typos.