Producers of NBC's "Will and Grace" have revealed that the #MeToo-inspired episode that aired earlier this week was a direct response to the testimonies given at the Brett Kavanaugh hearing and Bill Cosby's sexual assault trial.

In an interview with The Hollywood Reporter, "Will & Grace" co-creator Max Mutchnick revealed that they envisioned the episode following Cosby's 10-year sentence to prison for his sexual assault crimes.

In the episode, Debra Messing's character, Grace, reveals that she was molested by her father's best friend as a teenager.

“This episode was an outgrowth of what was going on with the Bill Cosby case,” Mutchnick said. “We were very taken by the raw coverage of these stories and what made them so potent was the fact that we were hearing the specifics about what had happened to these women,” he added.

Once the production team decided how they wanted to execute the episode, Mutchnick explained that they wanted Grace's assault experience to impact viewers.

“There was never going to be a line where Grace said on this sitcom, ‘He touched me down there.’ It was always going to be something specific and graphic, and we just had to figure out how far we wanted to take it and what felt right for the show," he said.

In the episode, Grace tells her father, who is played by Robert Klein, that his friend “pulled down my pants and put his fingers up…”

KAVANAUGH ACCUSER REFERRED TO DOJ FOR FALSE STATEMENTS, GRASSLEY'S OFFICE ANNOUNCES

Another line in the #MeToo episode was added into the script after the testimony of Kavanaugh accuser, Dr. Christine Blasey Ford, before the Senate Judiciary Committee on September 27.

After Grace explains the assault to her father, in shock, he tries to dismiss her and says: "Maybe you're misremembering."

Grace then replies confidently: "No. I remember. I remember every single thing that happened that day."

David Kohan, another one of the show producers, said the line was "a definite response to what we had heard" in Senate hearing testimonies.

"There is something so upsetting and condescending and minimizing about somebody saying, 'Hey, I believe this happened to you but maybe you’re misremembering the person,'" he told THR. "It’s so incredible and that is basically the lie that people have to believe if they say, 'I’m going to believe Dr. Ford but I’m also going to believe Brett Kavanaugh.' Of course it’s absurd. For an entire political party to try to walk that tightrope is insane."

Both co-creators of the NBC show, a network that has also had its fair share of #MeToo cases dealing with assault and misconduct in the past year, decided that this was the right time for Grace to share her "#MeToo moment."

The episode is also a tribute to the late acting legend, Debbie Reynolds, who played Messing's mother on the series. The episode concludes with Grace visiting her mother's grave and revealing that other than her father, her mother was the only person she told of the assault.