Mindy Kaling wrote and stars in "Late Night," a comedy out next month about inclusion and diversity in the workplace.

The actress, 39, who rose to fame through her role as Kelly Kapoor on "The Office," spoke about how her own experiences in the entertainment industry molded the concept of the film, which is the first feature she's created.

"'Late Night' was a really rewarding movie to write because I was in this unique position where I completely identified with both Molly’s character and Katherine’s character, played by Emma Thompson,” she said in an interview promoting her year-long partnership with DSW.

Kaling's character, Molly Patel, is the only female hire in the writers' room for late-night talk show host Katherine Newbury, played by Thompson. The actress said some of her character's experiences mirrored her own when she started out in the industry.

"Molly had an identical experience as I had when I first started working on 'The Office,' where I was the only minority and the only woman to work on the writing staff," Kaling explained.

"I remember that so vividly. The nervousness I felt ... going into that mostly Harvard room of writers, who had all worked on TV before, and feeling so overwhelmed and being so nervous I was going to get fired every day, for like a year," she continued.

However, she said she eventually made some of her best friends through the show.

Kaling was also able to connect with Thompson's character in "Late Night" because of the many projects she's produced and spearheaded, like her show "The Mindy Project," which ran from 2012 to 2017.

"I also know the experience of being on my own show, where I'm the star of the show and the showrunner, and I’ve been doing it for years: the impatience I feel, and you’re not always the ideal employer and all those frustrations, so I really identified with Katherine as well. That’s why the movie was so fun to write," she said.

The movie highlights representation in writers' rooms, an area Kaling says has transformed dramatically in recent years.

"The TV directing world still has a long way to go to catch up, but I will say -- and I feel proud to say as a writer and as an employer -- that the changes I've seen in writers' rooms have been significant, even in the past three years," she said.

"I don’t think it would even be possible to have a writers' room that looked the way that it did when I was starting out … and I think that would be a real problem for a lot of different people involved at the studio and the network that that would happen, so that’s, I think, really nice. I know there are still some rooms that are like that but it’s becoming more and more obsolete, which is great."

Kaling started working on the screenplay five years ago but still acknowledges that many elements within it are extremely timely.

"It predated the #MeToo movement by a couple years," she said about when she began creating the film. "And the movie isn’t really about the #MeToo movement, but there’s some themes in it that are kind of #MeToo-adjacent."

"I feel happy that people think it’s timely because I've been working on it for a long time," she added with a laugh. "I love writing about inclusiveness and employment, about intersectional feminism -- those are the kind of things that are interesting to me to write about. I literally feel so lucky that it’s the kind of thing that you’re reading about in the newspapers."

Another component of Kaling's passion project that was important to her? Finding the proper fit for Katherine, and Kaling says casting Thompson, who almost immediately agreed to do the project, was, "a complete and utter dream come true."

"She's been somebody who I have loved and has been my favorite actress since I was like 12 and 13 years old," Kaling said. "I remember seeing "Much Ado About Nothing" in theaters, kind of being dragged to go and kind of thinking like ‘I don’t want to see this Shakespeare play,’ and then thinking it was the funniest and coolest movie. And I saw it two more times that summer when it came out."

Kaling's two other favorite Thompson films are "The Remains of the Day" and "Sense and Sensibility."

"I remember watching the Oscars when she won an Oscar for writing and thinking, ‘You can do that? You can be star in a movie and win an award for writing it? That’s incredible'...so she was kind of on a pedestal for my whole life."

PHOTO: Emma Thompson and Mindy Kaling from the 2019 film, "Late Night," pose for photographers at Corinthia Hotel London on May 17, 2019, in London.
Dave Hogan/Getty Images
Emma Thompson and Mindy Kaling from the 2019 film, "Late Night," pose for photographers at Corinthia Hotel London on May 17, 2019, in London.

The two hit it off on set, in part to Kaling's appreciation of Thompson's complete honesty.

"She has this kind of confidence and looseness about her," Kaling said about her co-star. "She’s not guarded about her opinions...and that is so nice. That’s really refreshing to be around, rather than the guarded, scared demeanor of a lot of young actresses, who don’t want to offend anyone. That was really fun to be around -- a person with big opinions who's not afraid to show them."

Aside from the film, which hits theaters on June 7, Kaling is thrilled to promote her partnership with DSW, which she says is a place where she has many fond memories of shopping with her mother.

"I was into fashion when I was 12, 13 years old -- when I didn’t have money to spend on that kind of stuff, and we shopped at DSW always -- back to school, when I was in college I got my prom shoes there," she said.

"It was just a way to bond with my mother. We weren’t like these LA, New York mother-daughter pairs where we went to soul cycle together," she added. "We bonded by going to Macy’s and going to DSW."