Mindy Kaling admits she wrote the main role in “Late Night” for Emma Thompson before she actually met the actress.

Kaling appears on Monday’s “The Ellen DeGeneres Show”, where she talks about her new flick and being a huge fan of Thompson.

“Late Night” sees the British star play a late-night talk-show host who gets criticized for having a writing team made up of white males. She then hires Kaling’s character, but isn’t over-the-moon about it.

RELATED: Mindy Kaling Says Rebooting ‘Four Weddings And A Funeral’ Has Been ‘Terrifying’

Kaling says of Thompson, “She’s done so much drama and not that much comedy, but she’s really funny and came from comedy.”

She adds of not meeting Thompson before offering her the film, “It was a stupid thing to do. I was just in L.A. creepily writing this movie about a woman I was a fan of. She’s hilarious and never gets to do funny parts. She just turned 60, and I was excited to see her in this kind of role.”

RELATED: Emma Thompson Says She Wrote Prince William A ‘Fan Letter’ After Damehood Ceremony: ‘I Was Incredibly Impressed’

Kaling then talks about attending this year’s Met Gala, insisting she always feels like the “least famous person there.”

She explains, “When I go to that, it’s so glamorous and the charity is wonderful. And I think I have a nice career and I’m doing well. But the minute I go to the Met Gala, I’m the least famous person there.”

“Everyone is a European billionaire who doesn’t watch American sitcoms, and they sit me next to a random person and I have to explain my deal to them. They don’t get it: ‘Oh, so you’re like Harry Styles’ publicist?’ And I keep trying to explain it to them.”