What happens when you’re a new mother caught between having to choose between your personal and your professional life? That’s the question Kris Swanberg tackles in her latest film, Unexpected. Premiering at the Sundance Film Festival next month and starring How I Met Your Mother’s Cobie Smulders, Unexpected tells the story of an unlikely friendship between a high school teacher and a young student, who both find themselves in a similar situation when they get unexpectedly pregnant. Swanberg, who wrote and directed the feature, based the story on her own real life experiences as a new parent who found herself trying to balance motherhood and work, as well as her experiences teaching in a Chicago public high school.

“Having the movie come from a personal place and then writing it and then directing and then working through post-production really made the process a little bit more cohesive because I was super aware of everything,” explained Swanberg, who shot the film in her hometown of Chicago this summer. It was primarily the strength of that personal connection that led Smulders to the role of Samantha.

“I thought it could be just a very moving story about women, about the decision to have children,” Smulders told EW. “And from my side of the story, the decision of career versus motherhood, and trying to juggle those. At the same time, these two women are having the same experience, but under very different circumstances. The juxtaposition of that is very interesting to watch play out.”

For Smulders, who coincidentally happened to be pregnant with her second child at the time that filming took place, the experience was one that was both eye-opening and rewarding. “I wasn’t showing, so we still had to do a lot of fake bellies,” the actress said with a laugh. “But we got to use a lot of it, and also it was easy to sort of obviously pull sense memory for a lot of the stuff… I have a child, but she’s much older now, so it was interesting to sort of have that, to have my body actually lend itself to whatever we were shooting.”

“That was amazing, because she was so open to letting her use her real belly in the movie,” Swanberg added. “There’s a scene with an ultrasound, and we were able to use her real ultrasound.”

The strong female friendship that develops between Samantha and her young student, newcomer Gail Bean, is one of the overarching themes of the film and also one that Smulders sees as being one of the biggest appeals. “There’s a lot of relatable topics,” she said. “I also feel like people, myself included, operate under a lot of assumptions. I assume that because you’re a 16 year old girl, your experience is going to be like this. And it kind of twists everything—this movie allows you to see everything from a different perspective, and the character that I play is learning all of this as the audience is.”

Next, Smulders will co-star with Guy Pearce in Results, another Sundance film directed by Andrew Bujalski, about personal trainers living in Austin. And of course, there’s a little film called Avengers: Age of Ultron, out this May, in which the actress will reprise her role as former S.H.I.E.L.D. agent Maria Hill.

“There’s so many pieces to this giant puzzle, and I’m happy that Maria Hill is one of them,” Smulders said when asked about where one might find her character, last seen interviewing at Stark Industries after the fall of S.H.I.E.L.D. in Captain America: The Winter Soldier. “She’s working for Tony Stark, yes, but they shot so many locations all over the world and this team is out doing all sorts of things. So I like to think that Maria is at headquarters, trying to keep everything running as smoothly as possible. And working for Tony Stark is a whole other ballgame. She doesn’t have S.H.I.E.L.D. personnel to back her up at her disposal, so it’s an entirely different vibe for her.”

Don’t expect those words to mean we’ll see the character sidelined, though.

“I see Maria as having a more of a female presence in this world, and it’s really exciting to have Scarlet Witch [Elizabeth Olsen] come in, and to see the Black Widow [Scarlett Johansson] have these amazing moments, and see more women on film with all these dudes. It’s great.”