There’s a pivotal scene in Mike Birbiglia’s semi-autobiographical film “Sleepwalk With Me,” out Friday, where his character, struggling comedian Matt Pandamiglio, bombs while opening for an established headliner (played by Marc Maron).

A defeated Birbiglia and a glowing Maron are talking after the show when Birbiglia says: “I’ve decided I’m not gonna get married until I’m sure that nothing else good can happen in my life.”

Maron laughs. “You should tell that on stage,” he says.

It’s the moment that turns Birbiglia into a real comic. It’s when he realizes why no one laughs at his silly jokes about the Cookie Monster and “The A-Team.” He wasn’t being honest.

Birbiglia has made a career out of deeply personal storytelling, and it comes across on film. Sure, “Sleepwalk” is ostensibly about how Birbiglia started acting out his dreams in his sleep because he felt pressure to marry his girlfriend, but it’s also the story of how he became a good comic.

Audiences recognize honesty in comedy, and the events in the film are based — in part — on Birbiglia’s life. As his character starts being more honest on stage, he starts killing. Just like in real life.