LOS ANGELES — Josie Totah is 18 years old and already has the career many actors twice her age would be envious for. With roles in “Glee,” “Spider-Man: Homecoming” and the NBC Mindy Kaling comedy “Champions,” Totah is a rising star. But throughout her career, she has always yearned for a different part than the ones she played.

“When I was on the show ‘Glee,’ I’d stand back and watch Lea Michele,” Totah wrote in an essay for Time. “She was fabulous. And it was fun to see her and the other girls wear dresses and put on lavish musical numbers. But it was also hard, because I wanted that to be me.”

In the essay published Monday, Totah, who went by “J.J. Totah” professionally, made an announcement: “My pronouns are she, her and hers. I identify as female, specifically as a transgender female. And my name is Josie Totah.”

Kaling tweeted her support saying, “I’m so glad you’re able to speak your truth and live as your authentic self.”

In the essay, Totah says that even before she knew what the word “gender” meant, she “always knew on some level that was female” and asked to wear dresses as soon as she could speak full sentences. But it wasn’t until she saw the documentary series “I Am Jazz,” about transgender activist Jazz Jennings, that she decided to pursue hormone replacement therapy.

One constant obstacle Totah faced was people’s assumptions that she was a gay man. She wrote that reporters asked her how it felt to be a “young gay man” and LGBTQ+ rights organizations would introduce her that way when when presenting her with awards. Totah felt like she had to hide her identity and would wear the girls clothing she wanted to wear under sweatpants and sweatshirts.

“I almost felt like I owed it to everybody to be that gay boy,” Totah said. “I was afraid I wouldn’t be accepted, that I would be embarrassed, that the fans who knew me from the time when I acted in a Disney show would be confused.”

However, over time, Totah said she realized hiding her true self wasn’t healthy and she was “ready to be free.” Even though she is still afraid of being judged or rejected by people who don’t understand her, she says it’s a great feeling to be supported by those around her.

“When my friends and family call me Josie, it feels like I’m being seen. It’s something everyone wants, to feel understood,” Totah wrote. “I believe that I am transgender to help people understand differences. It allows me to gain perspective, to be more accepting of others, because I know what it feels like to know you’re not like everyone else.”

Totah, who heads to college this week, said she is planning to keep pursuing acting and will audition for female roles, as opposed to the male roles she was known for.

“I can only imagine how much more fun it’s going to be to play someone who shares my identity, rather than having to contort myself to play a boy,” she wrote. “I’m going to gun for those roles, be it a transgender female or a cisgender female. Because it’s a clean slate — and a new world.”

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM