In her new film, Maryam Keshavarz finds both gravity and levity in the struggle to reconcile her Iranian heritage and her life in the United States.When Leila, the central character in the new comedy-drama “The Persian Version,” sashays across the Brooklyn Bridge and into a Halloween party carrying a surfboard and wearing a burkini — niqab on top, bikini on the bottom — while Wet Leg’s cheeky anthem “Chaise Longue” plays, it’s clear that what’s to come will be a boundary-pushing take on straddling cultures that are at odds in the real world.Maryam Keshavarz wore a similar burkini costume once upon a time, and her semi-autobiographical film — which spans decades and moves between Iran and the United States — won an audience award and a screenwriting prize at the Sundance Film Festival in January, where it had its world premiere. The film, written and directed by Keshavarz, will have a limited theatrical release in the United States on Friday.“The reality is, I’ve never really followed the rules,” Keshavarz, 48, who was born in New York to Iranian parents, told me in a video call earlier this month. “It’s also the reason that probably I’ve been able to get to where I am, because there’s no real path for us, is there? There’s no straight path if you’re an immigrant kid, if you’re queer, if you’re an outsider.”Keshavarz was an adult when she grasped that immigrants and women could be directors. “I thought that was stuff for white Americans,” she said. “Even the idea that we have a right to tell our story and to take up space is huge.”Women who follow the rules “would be crushed,” she came to understand. “It’s a society that doesn’t allow us to get what we need to survive and flourish. So we have to take things into our own hands.”Here are edited excerpts from our conversation. Light spoilers ahead.Your film is arriving at a time when there’s heightened attention on the oppression Iranian girls and women face: The imprisoned Iranian activist Narges Mohammadi, who focuses on women’s rights in Iran, recently received the Nobel Peace Prize, and this month, a 16-year-old girl entered a subway car in Tehran with her hair uncovered and was later dragged out unconscious. How does your film fit with this larger picture?Of course, we are so grateful that the international voices have been used to amplify what’s going on in Iran in the last year, but this has been an ongoing issue ever since I can remember, we’ve been fighting against in Iran — all the morality police and, at every level, women, because they’re the symbol of the Islamic culture with the hair-covering and everything — have been on the forefront of pushing back.If you look at my film, my mother in the ’60s, she’s fighting against cultural norms to have her place in society. It’s not a battle that’s won in a day. And particularly young women, I’m in awe of them. The young girl who plays my mother at 14 (Kamand Shafieisabet), she lives in Iran, and she could have stayed in America, but she decided to go back after Sundance. She said, “It’s my duty to fight in my country.”More than anything, this is an international issue. The reason it’s caught fire around the world is because it’s not just about Iran. We also have issues here in the U.S. I think finally we understand that there’s more of an interconnectivity in our struggles.A scene from “The Persian Version.” Niousha Noor, in green, plays the mother, Shireen, who is based on Keshavarz’s own parent.Yiget Eken/Sony Pictures ClassicsKamand Shafieisabet has the film’s most dramatic moments. What was casting like for you, since you were essentially casting your own family?Everyone is Iranian. I was really dedicated to have actual Iranians. It didn’t matter what diaspora they were in, and it was so meaningful for them because all of us grew up in different countries.[Shafieisabet] lived and breathed this character, and she joked, “I’m giving birth to a child, and I’ve never kissed a boy.” She’s never acted. She was literally a freshman in high school. I wanted someone that was that innocent to play my mother, because my mother truly was at that time.When my mother met her — and my mom’s very verbose — I said, “Mom, you’re so quiet. What’s wrong?” And she said, “You know what? I never realized how young I was until I saw this girl. I was her age. I was a child. I was always struggling so hard to survive. I never had a moment to reflect.”Why is it important for you to elevate the stories of those who exist in that very particular space between cultures?To me, that’s quintessentially what it means to be American. You come to America and you’re allowed in many ways to continue your original national identity and still become American, and preserve those two things side by side. Also I wanted to take back the narrative of what it meant to be American. But more than anything, when you’re from two different places, you’re a bit of an outsider of both. And you do see the absurdity of both sides in some ways, and you understand it probably more than others would. So in some ways you become a translator of both cultures.Even Leila being a lesbian who gets pregnant by a man, as you did, plays in that in-between space.My family was so confused. That’s really the truth. Because I’ve been so adamantly with a woman and had been married and queer. We went out for drinks, and I was about to wimp out. Then the father of my daughter was like, “You’ve got to tell them.” I was like, “I’ll send them email.” And I did blurt it out just like that. Then they thought he was gay. They were so confused. The story of my life. As confused as me. [Laughs]That was very hard for me even to say “bisexual” for a long time. I was like, no, I’m queer. Also because of politics. It’s important that we have a sense of gay rights, regardless of the spectrum that you’re on. I’m from an older generation; my daughter’s generation has a completely different perspective on it. It was very important for me just to be adamant about our political rights as a community. But I realized life is more messy than the political movements allow us to be.Layla Mohammadi as Leila and Noor in a dancing scene from the movie. Yiget Eken/Sony Pictures ClassicsYou balance a lot of opposing themes: duality of identity, of course, but also comedy and drama, as well as different cinematic tones as we move through time and locales. Was it a struggle to bite off so much?I struggled with two things. One was the balance of the comedy and the drama. Another was to have an epic tale that was so intimate. That was very important for me, not to get lost in the period detail but to know that this is a story of essentially three women and to really ground it. And to do that, I decided that each character would have a different genre that’s reflective of who they are: So that the daughter is more ’80s-’90s pop. The grandmother is a tall teller of tales, as all grandmothers are, so she gets a spaghetti western. And then the mother, who, even though she’s created a new identity, is still traumatized by an old past — what you typically think of Persian films, which is like [an Abbas] Kiarostami sort of film.For me, it was important that all three women get to tell at least their version of the story. When I was writing it, I couldn’t crack the story until I realized my mother was the other writer. Because she came to this country to write her own future, rewrite her life. Once I got that, everything else fell into place. I realized all the men are just a chorus to our stories. And typically, it’s the other way around.On that note, do you really have eight brothers?In real life, I have seven brothers. In the story, I have eight. But I did grow up with one bathroom. I’m very traumatized to this day. I just have to have my own bathroom. [Laughs]The chaos of many siblings adds levity for sure. The movie, despite tackling serious topics, is also largely a comedy packed with big food scenes, choreographed dance sequences and tons of music, including Wet Leg at the start, but also Cyndi Lauper and Gagoosh.Certainly when I was a kid, Iran was synonymous with terrorist. And that was not my experience of Iran or Iranians. I’m like, “We’re so lazy. How can we be terrorists? We like to take long naps after lunch.” But honestly, it’s not the people I know; it’s not the culture and the celebration, the music, food. That’s a real political thing, too, what aspects of our culture are shown. I mean, if we can dehumanize people, it’s so much easier to invade them and to kill them and to take their oil and to create nameless wars, faceless wars. So I think the reason I went into cinema post-9/11 was to create a more nuanced view of our world. This film is in some ways a culmination of my entire career. I don’t believe in all this divisive rhetoric, and I feel like humor is a way that we can connect. More