She almost gave it all up.

After decades as a working actor rolling through short-lived sitcoms, pilots, voiceover gigs and smallish movie roles, Pamela Adlon finally realized her dream of landing her own series, FX’s “Better Things,” in 2016.

The autobiographical show was well-received by critics and yielded two consecutive Emmy nominations for lead comedy actress. Adlon joined FX’s roster of hot-shot auteur stars such as Donald Glover, Zach Galifianakis and the “It’s Always Sunny in Philadelphia” gang. Season 2 of “Better Things” generated even more glowing reviews and praise for her work as writer, director, producer and star.

And then the #MeToo explosion happened. In November 2017, Adlon’s longtime friend and collaborator, Louis C.K., was publicly accused of sexual misconduct by multiple women — allegations he later acknowledged to be true — in the pages of The New York Times. The story hit a week before “Better Things” aired its second-season finale.

The report was “just like a Molotov cocktail,” she says. “And when a Molotov cocktail goes off it just ignites.”

At one point, Adlon was so traumatized she didn’t know if there would be a Season 3. Getting there — the show returns Feb. 28 after 15 months off the air — was a painful odyssey that proved a lesson in resilience and perseverance.

Adlon didn’t think she had the drive to tackle another season of “Better Things.” She figured the show would become collateral damage amid the incendiary charges leveled against its co-creator. FX Networks moved quickly to sever ties with C.K. and his Pig Newton production banner, home of “Better Things” and three other series. Adlon has not been in contact with C.K. for many months.

“It’s really hard to function when you’re in shock and in grief. I’d lost my passion,” she says. “I was devastated of course over all the things that I heard about the women. And also for my partner and friend.” She didn’t doubt that she could handle the work on “Better Things,” but she questioned whether she could put so much of her emotional life on-screen at a time when she was despondent. Adlon is writer, director, showrunner and star of the series that is rooted in the pathos and bathos of her life as a working actor — she’s been at it since age 9 — and single mother of three daughters.

“The hardest part for me this year was seeing the show after what happened with Louie. I didn’t really even have a passion to do it anymore, because that was something that we did together,” she says.

C.K. had been Adlon’s writing partner since 2006, when she played his wife on the short-lived HBO sitcom “Lucky Louie.” He gave her a big boost at a pivotal time by casting her in his FX series “Louie” and making her a producer, which put her on the path to “Better Things.” C.K. was co-creator with Adlon of the show and co-writer of most of the episodes of the first two seasons.

The Times exposé made it plain that the man who had done so much to help Adlon find her creative voice had indulged in egregious behavior that squelched the creative voices of other women.

Adlon’s mood was exacerbated by a string of soul-crushing events, ranging from having to evacuate her home in December 2017 because of the Skirball fire to the deaths by suicide last year of Anthony Bourdain and Kate Spade. She didn’t know either of them, but their tragic ends added to her sense of general malaise.

“Each thing felt like a brick in my stomach,” she says. “I was shaking for, like, six months.”

Standing five feet one, with a husky voice and a guttural, slightly deranged laugh, Adlon, 52, has been the casting director’s definition of a spitfire since she was a preteen.

She’s played sexpots and wives, ditsy girlfriends and hardened feminists, and plenty of boys and young men, particularly in her prolific work as a voice artist in animation. (She won an Emmy in 2002 for her role as Bobby Hill on the Fox animated comedy “King of the Hill.”) She’s quick to describe her personal style as being on the “butchy” side. She was born with the industry in her blood — her father was TV writer Don Segall.

Before “Louie,” Adlon made a mark with her supporting role as the brazen wife of a talent agent on the Showtime comedy “Californication.” The character was envisioned as a minor player, but Adlon infused so much life into Marcy Runkle that she became a regular for all seven seasons.

“Pam is a great cusser,” says David Duchovny, who was the star of “Californication.” “That sounds flip, but not everybody can do it. She’s able to use every word in the English language and make it funny. There were a lot of heightened, absurd situations [on the show], but we were always trying to center it in a real emotional space. Pam was able to stretch and be absurd but always keep it real.”

Janell Shirtcliff for Variety

Like her Sam Fox character on “Better Things,” Adlon has a house full of kids, and she is also a parent to her aging mother, who lives next door to her daughter’s home in the San Fernando Valley.

After the C.K. imbroglio, Adlon was ultimately buoyed by the support of many friends and those she considers her extended family. She credits two people in particular with guiding her back to work: FX Networks CEO John Landgraf and her old friend and showrunner pal, “Everybody Loves Raymond” creator Phil Rosenthal.

“Everything was step by step, from scorched earth to rebuilding. It was so crazy,” she says, reflecting on the past year during a lengthy interview with Variety over breakfast at the 101 Coffee Shop in the heart of workaday Hollywood. After the tattoo-covered server (who could easily play one of Sam’s friends) informs her that sardines are not an option, Adlon settles for a side of pumpernickel bread and black beans with her huevos rancheros.

Landgraf gave Adlon the vote of confidence from on high and the gift of time to work out a new production process. Rosenthal offered pointers on assembling a writers’ room and how to work with a team to craft the scripts.

“There were times she worried about whether Louie’s fall would take down the show,” Landgraf says. “She knew if it was going to continue, it had to continue without him. I can tell you from my standpoint, the only thing she had to fear was fear itself. I knew it was going to be hard, but I didn’t have any doubt by that point in her abilities. We are witnessing the emergence of a major storyteller and filmmaker whose career in that regard has just begun.”

For Adlon, hearing the words “I understand” from the network’s top leader made an enormous difference. She was struck by how far she’d come from her early days in the 1980s, scrambling for guest spots on “The Facts of Life” or toughing out her first series regular role on the ill-fated “The Redd Foxx Show.” Or the time she was fired from the raunchy Fox comedy “Down the Shore” in 1992 because she wasn’t attractive enough. This time wasn’t like those.

“My network said to me, ‘Take your time.’ The amount of support and just taking the pressure off of me that they did …” she says, trailing off as she shakes her head and takes a deep breath. The depth of her gratitude is hard for her to articulate. “I told John that I don’t really want to do this anymore. John said, ‘I’m not going to force you to do anything, but I want you to do the show.’”

Rosenthal has been a close friend for years. The two first met when he was working as a writer-producer on “Down the Shore.”

“She’s family,” Rosenthal says. It pained him to see the person he knew to be so funny, full of life and talented become debilitated by something over which she had no control. “She was devastated personally and really frightened professionally. You work your whole life to get a show like this, and suddenly it’s in jeopardy.”

Adlon had no shortage of people encouraging her to move on from the C.K. scandal. But Rosenthal could speak to her as a showrunner, and he offered invaluable advice. Her path as a writer-producer had flowed through C.K., starting when the pair drove the writers on “Lucky Louie” crazy when they began crafting their own stories and dialogue for the show.

“Every few days Phil would text me and say, ‘How are you doing?’ And then he helped me get into the consciousness of creating a writers’ room,” Adlon says. “He said to me, ‘I promise you it’s the most un-lonely feeling you’ll ever have.”

Rosenthal counseled her on how to size up a writer’s work from sample scripts and how to speed-date for compatibility. Adlon assembled a team of four writers — two women, two men — and began hammering out the story arcs for the next season. Rosenthal looked at a few pages here and there, but he had no formal title for Season 3 other than “dear friend.” He’d given her similar support when “Better Things” was first coming together.

“It was easy to encourage her. All I did was state the obvious that this was really good stuff,” Rosenthal says. “What Pam has is something that is vital to any show. She has a very clear sense of purpose. She knows what the show’s supposed to be. No one can tell her what the show is; she lived it. Knowing what you want to say — that’s 90% of the battle.”

Courtesy of FX

Adlon has a whole lot that she wants to say with the new batch of “Better Things” installments. As in Season 2, she directed all 12 episodes. And she takes her camera to intimate places. She opens the season with a sequence that demands as much courage as anything Tom Cruise ever did with a helicopter in “Mission: Impossible.”

She sets the tone with a long scene inside her closet that takes a brutally honest look at her shape-shifting fiftysomething body. She reveals herself standing in a bra and underwear, battling with trousers that are suddenly too tight. She offers a close-up of the spare tire that has settled around her waist. She lays bare her denial that the aging process is irrevocably changing her physical form. It’s a theme of the season.

“By the end of Season 2 my body changed so dramatically,” Adlon says. “All of a sudden I can’t fit into the pants I was wearing three months ago. So I went through this in my closet. I just started putting on clothes and throwing them away. And then I thought, I should save the ones that don’t fit for the show.”

She was planning to do a less candid version until she got through shooting some of the material in subsequent episodes. In a girls’-night-out scene, Sam and her friends get rowdy in a restaurant with a hunky waiter, among other adventures. Adlon wanted to pull some punches in her scenes but realized she couldn’t do that and still ask other actors to be fearless.

“I thought, ‘I’m never going to do this. I’m never going to do this.’ I was going to do it with smoke and mirrors, and then I shot a scene with some other women, and I realized, I can’t f—ing ask them to do what they did and not do my thing. So it was just like written and locked and loaded. I think it’s the next progression for this character, and it’s a beautiful thing. When I see it all cut together I get so excited for women to see it.”

Another device in Season 3 that’s sure to be talked about is the brief fantasy sequences that are woven into the episodes. Sam is plagued by disturbing visions of her former husband (the character, played by Mather Zickel, is named Sam’s Ex) and less disturbing visions of her dead father. The ex-husband storyline will undoubtedly be interpreted by some through the lens of the C.K. debacle. But the story point came to her as she was finishing up filming on Season 2, before the C.K. disclosures.

“One day it just hit me,” she says. “I told my camera operator, ‘Grab a piece of paper — next season he’s coming to me in my dreams.’”

Adlon has tread lightly on storylines involving Sam’s ex out of respect for her real-life children and their relationship with their father, Adlon’s former husband. In the third season, she deals more directly with the family’s struggle with what she calls “the dads who disappear.”

“I’m dreading for my daughters to see this,” she admits. “Everybody is going to interpret this in their own way. For me it’s simply about Sam being haunted by old relationships.”

Adlon also delivers a commentary on the #MeToo movement and the change she hopes it sparks across the industry. Sam is cast in a low-budget zombie movie where corners are cut at every turn when it comes to safety and working conditions. The moment when she finally gives the asinine director a piece of her mind is a fist-pumping feel-good moment, “Better Things” style.

“I’ve been working since I was 9. I’ve seen just about everything. I’ve been the teenage girl where the director says, ‘It would be really funny if you just dropped your towel,’” she says, anger rising in her voice. “Abuse of power on sets has affected me my whole life. I pride myself on the way I run my set. This is why I’m good at running a show. I’ve been abused, and I’ve seen abuse, and I know there’s no reason for it.”

Mikey Madison, who plays Sam’s oldest daughter, Max, has nothing but admiration for her fictional mom.

“She gives so much of herself to this show,” Madison says. “It makes me really push myself to make the show as good as it can be. Watching her dedication to writing, directing, starring, makes me think maybe I could do that someday.”

Adlon is proud of the working environment that she has established on the show. Her acting training has made her highly empathetic — she’s quick to insert “No slam but …” in conversation when discussing artistic choices or parenting techniques or personal conflicts. For all of her experience in the biz, she’s still getting accustomed to being in the spotlight and talking about herself to journalists. “How many off-the-records do I get?” she asks during the interview, in all sincerity.

Janell Shirtcliff for Variety

Her animated spirit has a calming effect on her co-workers.

“When she walks on a set, everybody unclenches. It’s ‘OK, Pamela’s here. This is going to be good stuff,’” says Hannah Alligood, who was an unknown actress from Birmingham, Ala., before Adlon cast her to play Sam’s middle daughter, Frankie.

Adlon’s typical joie de vivre made her depression after C.K.’s public shaming all the more concerning to her close friends. Not everything that happens on “Better Things” is drawn from Adlon’s life. But everything that has happened in her life has made it possible for her to deliver the show.

“She has a certain amount of world-weary cynicism and that 300-yard stare,” Landgraf says. “But she’s also got a kind of undefeated warmth and optimism. She hasn’t been digested by the Hollywood machine. She’s fiercely committed to and in love with her daughters. She’s committed to putting the emotional needs of her daughters first, and then she can be really honest about how much that costs her and how much she knows that they can be ungrateful little s–ts about it too. The way that she portrays their extended family in this show is the dramatic execution of the phrase ‘It takes a village to raise children.’”

In Adlon’s view, success in everything she’s ever tackled has started with being a good student and a good listener. She recently began taking a class on the history of Yiddish simply because she’s fascinated by the sound of the language. Now that “Better Things” is in the can, she’s ready to look around for new projects, particularly those that give her an opportunity to hone her directing skills.

“It’s my ear that has gotten me as far as I’ve come,” she says. “It helps to have a unique voice, but what really helps me when I’m casting or directing — if I see something that sounds a little bit tin, I’m able to hear it right away. It helps me keep everything in the frame sounding honest and looking real.”

After the long road to wrapping Season 3, Adlon has some jitters about how it will be received.

“The best thing about this handmade, janky little show is that when people see it, they don’t forget it. People come up to me crying and shaking. I love it. I give them a hug,” she says. “I was so excited before Season 2 aired. I couldn’t wait for people to see it. Now I’m just nervous.”

She also wonders where Sam Fox will be this time next year.

“God willing or God forbid there’s a Season 4,” she says. “I can’t imagine not doing it, but I can’t imagine doing it all again.”