Sarah Silverman is bold, hysterically funny, and always edgy on stage but in her personal life she has battled depression. The comedian candidly opened up to Glamour magazine about her experience with depression and panic attacks and how it inspired her to take on the difficult role of Laney Brooks – a self-medicating mother of two who struggles with mental health issues.

Amy Koppelman, the writer behind I Smile Back, asked Silverman to star in her movie after hearing her speak about depression on The Howard Stern Show.

“The story was about a suburban mother and housewife, Laney Brooks, who on paper has it all, but in reality suffers from depression and self-medicates with drugs and alcohol,” Silverman told Glamour, adding that she didn’t think the project would make it to production.

“Three years later I got an email saying, ‘It’s happening, we got the funding!’ I replied-all: ‘Yay!’ And then I collapsed on the floor of my bathroom, shaking. What had I done? I knew playing Laney Brooks would take me back to a very dark place.”

Silverman first encountered that dark place when she was 13-years-old. It kept her from seeing friends and going to school and lead to panic attacks.

Screen Shot 2015-10-14 at 10.47.24 AM

“People use ‘panic attack’ very casually out here in Los Angeles, but I don’t think most of them really know what it is. Every breath is labored. You are dying. You are going to die. It’s terrifying,” the 44-year-old said.

At the time Silverman saw several therapists and at one point was up to 16 Xanax a day. Years later her mom took her to a new psychiatrist who took her off medication and she started to feel like herself once again. At 22 she experienced another bout of depression, but learned something that helped her tackle the tough role in I Smile Back.

“There’s one thing I know that I used to not know: It will pass. And it does,” Silverman said.

That lesson helped her get through playing Brooks, who despite being married with kids does drugs, sleeps with the men, and disappears when she wants.

“I’m not gonna lie, [filming] was not a great 20 days. After we wrapped and I’d finally shed the heaviness of it, I was so glad I made this movie. It may not have been fun, but it was the next best thing: It was scary. That makes you grow.”

I Smile Back hits theaters on October 23.

Image credit: Instagram