The upcoming Mindy Kaling movie “Late Night” brought the audience at the Wellmont Theater to its feet Saturday at the 2019 Montclair Film Festival, where Kaling spent several hours with one of the genre’s maestros — Stephen Colbert.

“Late Night," starring Kaling and Emma Thompson, is the centerpiece film of the festival, which runs through May 12.

The film, directed by Nisha Ganatra, will open wide on June 7. The movie debuted in January at the Sundance Film Festival, where it was picked up by Amazon Studios for a record $13 million.

Gov. Phil Murphy — who boasted of the state’s restoration of film tax credits — was on hand to introduce Montclair’s own Colbert as he sat down with Kaling for a post-screening Q&A, which followed an earlier “in conversation” event with the film’s star.

For several years, the host of “The Late Show with Stephen Colbert” has been a key part of the festival, which started in 2012. Colbert’s wife, Evelyn McGee-Colbert, is the president of the festival’s board of trustees.

In “Late Night,” Kaling, 39, plays Molly Patel, a new writer for “Tonight,” a late night show fronted by veteran host Katherine Newbury, played by Emma Thompson. Faced with the prospect of being kicked off her own show, Newbury needs to liven up her stale routine. Specifically, she needs a woman to join her all-male writers’ room — as Kaling puts it, she’s shamed into making a diversity hire — and brings on Patel, a comedy fan who works in a chemical plant. She helps transform the show, along with Newbury’s approach to her public self.

Kaling at the Wellmont Theater with Colbert. Research for "Late Night" involved visits to the set of "The Late Show with Stephen Colbert."Lars Niki | Getty Images

“Late Night" is the first feature film Kaling has written and produced. She said she wanted to set the story in the realm of late night TV because she’s “obsessed" with it and wanted to explore the fast-paced, often cutthroat New York scene.

“I was really nervous to talk about it with you,” Kaling told Colbert, mainly because he could tell her whether or not the film was a realistic portrayal of what transpires on such a show and in its writers’ room.

“There are things that are missing from it that are part of the process,” said Colbert, 54, but the rest rang true. “Long bouts of lethargy punctuated by panic,” he said.

“I’d love to get together and watch it with me and Jimmy and Jimmy and Conan,” the late night host told Kaling, who nearly crawled under seat at the thought.

Colbert noted that the font for Newbury’s show in the movie is identical to the one used for “The Late Show with Stephen Colbert.”

He also pointed out that in the film, one writer for Newbury’s show (who gets fired in the beginning of the movie) is named Gabe Eichler. Colbert, meanwhile, has writers named Gabe Gronli and Glenn Eichler (another Montclair resident).

Pure coincidence, Kaling said.

Of course, the other similarities are hardly coincidental. Kaling’s film consulted Colbert’s show and writers in the process of researching writers’ rooms and the late night talk show environment.

“Yours is my favorite show to watch,” she told him.

“We’re done!” he said, getting out of his seat.

“I don’t think you necessarily identify as an activist, but you are unafraid,” Kaling told Colbert, expounding upon her admiration of his show and its approach to politics during the Trump administration.

The Emmy-nominated Kaling, who formerly starred in “The Mindy Project" on Fox and Hulu, became a household name playing Kelly Kapoor in “The Office," which ran from 2005 to 2013 on NBC. She said that after interning at "Late Night with Conan O’Brien” when she was a student at Dartmouth College, she was hired as a writer on “The Office” as part of an NBC diversity initiative.

“I was so embarrassed of that for years,” she told Colbert. “The only reason I was there was because it was free for the show because they didn’t have a budget.” In writing the screenplay for “Late Night," Kaling wanted to show what it can be like for a writer in that position.

Approx 1 month & 7 days until @latenightmovie hits theaters. But who’s counting? 🤷🏾‍♀️ June 7th! #LateNightMovie pic.twitter.com/32bFWsTFwH — Mindy Kaling (@mindykaling) May 1, 2019

Kaling ensures her own staff is diverse by hiring women of color to be her assistants and promoting them to be writers. She said women staffed more than 50 percent of the production for “Late Night."

Why write a woman as the 30-year host of a talk show when the late night landscape has been notoriously male-dominated?

“I did it because I wanted to see it," Kaling told Colbert, later calling the concept “science fiction.” She said Thompson, 60, is her favorite living performer, one who did not require rehearsals for the film. Members of the audience gasped when Kaling revealed that “Late Night” was shot in just 25 days.

Other Kaling projects on the way include a Hulu series that’s an adaptation of “Four Weddings and a Funeral," due out in July, and a coming-of-age comedy series for Netflix about a first-generation Indian American teen. She’s also writing a film comedy for Universal set in the United States and India in which she and Priyanka Chopra will star as “as cousins who are very different,” she told Colbert.

Mindy Kaling as Kelly Kapoor on "The Office" in 2008.Mitchell Haaseth | NBC

Here are some more highlights from Kaling’s appearance:

Kaling said her defining, or “breakthrough” career moment was when she made it on “The Late Show with David Letterman" for the first time in 2008. “He’s very intimidating and really represents something if you’re a comedy writer,” she said. Kaling ended up appearing on the show five times. “Each time, I really wanted to score,” she said. “No better feeling than making him laugh,” Colbert replied. Kaling: “No better feeling."

Kaling was already a writer on “The Office” when she got the chance to try out for “Saturday Night Live.” It had been her childhood dream to become a series regular. Steve Carell, her co-star on “The Office,” was convinced she would get a spot on the show. “I did some stand-up and I did my impression of Ben Affleck,” she said. Kaling was devastated when she was not cast as a performer, but Lorne Michaels thought she was funny and did want to hire her as a writer (which could have served as an avenue to becoming a member of the cast). Her boss, Greg Daniels, co-creator of “The Office,” told her the other writing job was not “good enough” to let her out of her contract on the show.

beware: spoilers ) one of her favorite shows to watch now, Kaling appreciated When it comes to “ Game of Thrones ," () one of her favorite shows to watch now, Kaling appreciated Arya ’s stealth dagger drop that slayed the Night King in the Battle of Winterfell, but “didn’t understand why the dragons didn’t fly out and try to do some damage." Colbert dubbed the dark nighttime episode (that many have complained about, if only for the lighting, or lack thereof) as “redacted.”

Kaling was asked whether she identified with any part of her “Office” character, Kelly Kapoor. “I hope not too much,” she said, describing Kapoor as “kind of like a sociopath."

Have a tip? Amy Kuperinsky may be reached at akuperinsky@njadvancemedia.com. Follow her on Twitter @AmyKup or on Facebook.

Get the latest updates right in your inbox. Subscribe to NJ.com’s newsletters.