‘How I Met Your Mother’ Alyson Hannigan’s Pregnancy Led to the Most Random, Out-of-Character Subplot

How I Met Your Mother might be a comedy, but the show also relies heavily on mysteries. However, one of the most intriguing ones doesn’t even get answered directly on screen. Rather, fans would have to dig into the behind-the-scenes story behind how star Alyson Hannigan’s real-life pregnancy impacted the TV show to reveal how it all played out.

Jason Segel and Alyson Hannigan stand at a window speaking to an unseen figure on 'How I Met Your Mother'
Jason Segel and Alyson Hannigan stand at a window speaking to an unseen figure on ‘How I Met Your Mother’ | Cliff Lipson/CBS Photo Archive via Getty Images

‘How I Met Your Mother’ creatively hid Alyson Hannigan’s pregnancy

Both of How I Met Your Mother‘s female stars — Hannigan and Cobie Smulders — became pregnant during season 4. Sometimes, showrunners opt to write such pregnancies into the show. But creators Carter Bays and Craig Thomas weren’t ready to bring children into their hit sitcom. Instead, the show’s costume department was able to creatively hide the pregnancies.

Throughout television history, TV shows have gotten away with using large purses, oversized clothing, and large props to hide baby bumps from the camera. How I Met Your Mother employed all of these tricks as well as some more unique ones. In one scene, Lily (Hannigan) has a bulging tummy due to winning a hot dog eating contest. But the show went to greater lengths.

RELATED: ‘How I Met Your Mother’: Alicia Silverstone Almost Played a Pivotal Role on the TV Show

But the show explained her absence in a very strange way

While Smulders’ pregnancy didn’t dramatically impact production on How I Met Your Mother, Hannigan’s maternity leave conflicted with the filming schedule. So to ensure Hannigan could appear in the season 4 finale, “The Leap” taped earlier than planned. But that still wasn’t enough. And so the writers devised a way to significantly write Lily out of a few episodes.

Hannigan only appears for a single scene in “Mosbius Designs.” The reason for Lily’s absence for the next few weeks? She is offended by a dirty joke Barney (Neil Patrick Harris) tells her. The narration claims Lily was so disgusted by the joke she stayed away from the bar for four weeks. However, this just doesn’t fit with what How I Met Your Mother fans know about Lily.

With the exception of Barney, Lily is the bawdiest of the group. The fact that she would stay away from the gang’s favorite hangout because of a dirty joke doesn’t really fit. Still, as a way to keep Hannigan off-camera, it’s better than no explanation at all. Lily is only completely absent from two episodes before reappearing in the final scene of “As Fast As She Can,” the episode just before the season finale.

RELATED: ‘How I Met Your Mother’ Once Hilariously Confronted ‘Friends’ Comparisons

Alyson Hannigan and Jason Segel’s characters eventually did have kids

Bays and Thomas might not have been ready to write a pregnancy into the show in season 4. But Hannigan and her TV husband, Jason Segel, do eventually become parents. Lily and Marshall (Segel) have their first child, a son named Marvin, at the end of season 7.

Towards the end of How I Met Your Mother, the show reveals Lily and Marshall later had two daughters. Hannigan’s real-life daughter was supposed to play one of these. But that didn’t exactly work out as planned. Regardless, Lily and the actor that played her became moms eventually.