Rachel Bloom, TV’s Crazy Ex-Girlfriend, opens up about the anxiety that told her she would fail—during a milestone year. As told to Emily Mahaney

In the pilot episode of Crazy Ex-Girlfriend, my character Rebecca googles, “How long can a person go without sleep?” It may seem like a weird thing to look up, but that scene was inspired by me at my very worst. Rebecca is ­depressed, and as my co­creator, Aline Brosh McKenna, and I were writing that episode, the anxiety and depression that had invaded my own brain like an alien when I was a kid came back in full force.

It all started with one sleepless night: Aline and I were pitching the show to networks the next day. In my head, this was my chance to “make it,” which hinged on my performing in those meetings. I had a friend staying over, and suddenly it was midnight. I said to myself, “Oh, you stupid bitch! Go to bed. You have a pitch in the morning!” I didn’t sleep for a second that night. By the time I met Aline the next day, I looked like I had been hit by a truck.

That started a spiral. Every night before a pitch that week, I had sleep anxiety. I became delirious—and afraid that I wasn’t sleeping; ergo I would ruin everything. But the lack of rest didn’t ruin the pitches, and I was good at covering up my anxiety.

A few weeks after these meetings, my boyfriend proposed. Previously, when we had dated long-distance, I feared that our relationship would fail, and then every time I saw him, I thought about that anxiety. So on this amazing night, my sleep anxiety combined with my old relationship anxiety, and all I could think was, Don’t be anxious—if you think about anxiety today, you’re going to associate anxiety with your husband for the rest of your life.

“During a spiral I have anxiety about anxiety,” says Bloom, 29. “It’s a snake-eats-tail loop.” William Callan/Contour by Getty Images

All this time I was trying to hide my feelings. Aline didn’t realize how dark it got; even with my boyfriend I struggled to articulate how bad it was on the inside.

So I was in this perfect storm—with the show, which by this time was a pilot, and the engagement—and then something happened with my birth control. The company sent me the same Pill from a different manufacturer, which shouldn’t affect people but affected me. I went from feeling anxious to sinking into the worst depression of my life. I needed help.