A pregnant doctor who was at a Kentucky hospital preparing to give birth got sidelined — to help deliver another woman’s child, which was in distress.

OB-GYN Dr. Amanda Hess was at Frankfort Regional Hospital over the weekend — preparing to be induced — when she overheard nurses saying that another mother needed to deliver right away because the baby was in distress, according to another doctor, Hala Sabry, on Facebook.

Hess had already put on her patient gown to prepare for her induction when she realized that the other patient needed immediate attention.

“My husband actually said, ‘Is that woman screaming?'” Hess told WKYT-TV.

The woman, Leah Halliday Johnson, was fully dilated — but the doctor on call was on his way back to the hospital after leaving for break, the station reported. Hess quickly realized there was no time to waste.

“I just put on another gown to cover up my backside and put on some boots over my shoes, to keep from getting any fluid and all that stuff on me, and went down to her room, and I knew her,” Hess told the station, adding that she recognized Johnson as one of her patients that she had performed a check-up on days before.

Johnson called Hess’s actions “pretty amazing.”

“I feel very lucky she was there and the type of person she is and step up to do what she did,” she told WLEX-18. “We really appreciate her.”

Hess, a doctor of osteopathic medicine who is board-certified in obstetrics and gynecology, later delivered her second child, Ellen Joyce. Both moms and babies are reportedly doing well — and Hess is expected to take eight months for her maternity leave.

“I had actually taken a call the day before, so I thought really that I was working up to the last minute,” she told the station. “But this was literally ’til the last second.”