On her last day of filming “The Way Back,” Janina Gavankar says Ben Affleck had a funny, if awkward, question for her.

“He didn’t know how to ask me this, but he was like, ‘Where did you…? Where did you…?’ And I finished his sentence. I was like, ‘Where did I come from?’” Gavankar told Variety. “I said, ‘Ben, I’ve been [acting] for 15 years. I’ve been marginalized for 15 years. There was no way I would get to act across from you in any of these years until now.’”

Gavankar, 39, plays Affleck’s estranged wife in the Gavin O’Connor-directed feature, a relationship strained by both addiction and personal tragedy.

And if Affleck’s question landed as slightly awkward, it’s because for over a decade, Gavankar has built up her resume with a slew of TV roles (“The L-Word,” “True Blood,” “The Morning Show”) and various creative endeavors, in everything from music to gaming. 

“One, I have a body of work that earned me the right to even audition. And two, finally, somebody like me gets to audition for a movie like that,” says Gavankar of her co-starring role in “The Way Back.” She adds with a laugh, “But also, realistically, they didn’t have money, and I was very cheap.”

As for Affleck’s reaction when she replied, Gavankar recalls the actor-director-writer leaning back, raising his eyebrow and nodding.

“He understood, and it’s one of the reasons I have an artist ally for life in that dude now,” she says.

Gavankar’s latest projects include playing the lead in the NBC pilot “Echo,” as well as the short horror film “Stucco,” the latter of which she starred in, in addition to co-directing, co-producing and co-writing with her creative partner Russo Schelling. 

The 18-minute short — which also features appearances from Debra Messing and Aisha Tyler, and original music by Questlove — centers on an agoraphobic woman, played by Gavankar, who, at one point, makes out with an oversized tongue jutting out from a wall in her home. 

“The cast of ‘Stucco’ is kind of hilariously fancy for no reason,” says Gavankar. “If you go to the IMDB page, it is like a joke. What is this no-budget indie film shot in someone’s house? How are all these stars in this one weird short film? But the truth is, talented people want to get weird.”

“Stucco” has been selected as part of SXSW’s Midnight Shorts competition. Gavankar personally funded a portion of the project. 

The drive to create work for herself, Gavankar says, comes largely from being a child of immigrants from India. It’s an experience she says has informed “every fiber of my being.” 

“I’m in such a strange industry that if you don’t have that engine, you’re just not gonna make it. Also, I’ve been a brown girl my whole life. When I first moved to L.A., there were no opportunities. There was really nothing,” she says.

She adds that saving her cash to be able to self-fund her projects comes from another tenet of her upbringing: “And another thing about being a child of immigrants is you never spend your money!”

It’s paying off. As she wraps up her bi-coastal press tour for “The Way Back,” Gavankar is headed into production on “Echo.” She’ll fit in attending SXSW and teaching a session about sound editing “Stucco” to students at Full Sail University, where the film was sound mixed. 

She says she has a slate of projects that are now, finally, starting to find homes. The timing is a confluence of factors, including that the entertainment industry is starting to prioritize inclusion and diversity, but also that she’s been grinding away for — as she reminded Affleck — 15 years. 

“People who have been marginalized have to work twice as hard, but it also means our muscles are twice as strong,” she says. “So when you give us a shot, we’re more than ready.”