The Reason Behind Lily's Disappearance From How I Met Your Mother Season 4

In the cold open of "Mosbius Designs," the 20th episode of season 4 of "How I Met Your Mother," Barney (Neil Patrick Harris) decides to tell Lily (Alyson Hannigan) a dirty joke. Although Ted (Josh Radnor) and Marshall (Jason Segel) tell him it's a bad idea and Lily's not going to like it, Barney goes ahead and asks her, "What's the difference between peanut butter and jam?" 

We never receive an answer, because Ted doesn't think it's a joke suitable to tell his children. But it's apparently so dirty that Lily reacts by saying, "I can't hang out with you guys anymore," and she isn't seen by the gang again for the next four weeks. The detail is followed through in the rest of the season, as Lily doesn't return until "As Fast As She Can," the 24th episode, which aired four weeks later. The joke about peanut butter and jam was a transparently flimsy explanation to justify the character's lack of airtime on the show. The actual reason? Alyson Hannigan was on maternity leave.

The season of cast pregnancies

Season 4 was an unusual period for "How I Met Your Mother" behind the scenes, as Cobie Smulders was also expecting. This makes the season a lot of fun on a meta level, because viewers can enjoy looking for all the little visual tricks the directors pulled to hide the signs. Lily and Robin were often holding strategically placed purses, wearing looser clothes than usual, and spending entire scenes sitting down behind a table. This is hardly a new thing for sitcoms, but Alyson Hannigan's pregnancy was played around with in some fairly novel ways — most notably, the running gag of Lily being a hot dog eating champion, where her real-life pregnant belly is used to show the effects of eating so many hot dogs at once. 

A few years later, "Brooklyn Nine-Nine" would take one of their cast member's pregnancies and incorporate it into the story in an ever wilder way. Season 3 of the police sitcom saw Amy (Melissa Fumero) infiltrating a woman's prison, pretending to be a pregnant inmate. There were plenty of jokes about Amy thinking her pregnant disguise wasn't realistic-looking, despite it being real as it could ever be for the actress.

For both shows, the creators' willingness to roll with the punches and work the show around pregnancies is nice to see, especially since actresses on other shows weren't so lucky. One infamous example is Charisma Carpenter, who was allegedly fired from Joss Whedon's "Angel" series due to her real-life pregnancy. The once-revered Whedon accused her of "sabotaging the show," emotionally abused her on set, and then wrote her character off the show out of retaliation, severely undermining a years' long character arc in the process. Although the final seasons of both "How I Met Your Mother" and "Brooklyn Nine-Nine" weren't as universally well-received as their earlier seasons, it's at least nice to know that when it comes to pregnancies, their showrunners weren't as bad as Whedon. The bar may be on the floor, but at least they got over it.