Mindy Kaling said she felt “terror” as an up-and-coming female minority writer in Hollywood.
The actress, who was born in the US to Indian parents, is starring alongside Dame Emma Thompson in comedy Late Night, which she also wrote.
It features Dame Emma as a late-night host who turns to a young minority writer when her career is threatened by allegations she hates women.
Kaling first found fame in the US version of sitcom The Office, before writing, starring in and directing her own comedy, The Mindy Project.
Asked how much of Late Night is based on her own experiences, Kaling told the Press Association: “I’m always so careful to say this because I came from The Office where I was, in the first year, the only woman and the only minority.
“The men who I worked with on that were not at all as unwelcoming as the men in this movie, which are obviously a source of the comedy and the drama in the film.
“But the terror I felt as a new writer and having to represent all women and all minorities in a writers’ room is really real.
“That is ripped straight from my own experience.”
Speaking at the film’s premiere in downtown Los Angeles, Kaling, 39, said she had Dame Emma, 60, in mind when she wrote Late Night, but had only met her once was not sure if she would say yes to the film.
Kaling’s agent sent a first draft of the script to Dame Emma, “and the best possible scenario happened,” Kaling added.
Late Night is directed by Nisha Ganatra, who described Dame Emma as a “comic genius”.
Ganatra said it was a “dream come true” to direct the Oscar-winning actress, adding: “Dame Emma is brilliant, the finest actor of our generation. She is just a comedic force. A lot of people don’t know she started in comedy.”
She added: “You put Mindy Kaling and Emma Thompson together and it is such a comedy powerhouse combination that it feels why cinema was invented. To watch these woman go at it like this is such a joy.”
Late Night will be in cinemas on June 7.