Mary Steenburgen on a red carpet for acting is nothing new. And when the promotions for Wild Rose, an independent movie about a gritty Glasgow girl transfixed by a Nashville dream, ramped up, the Arkansas-born, seasonal Vineyarder was everywhere. Only thing was, she never appeared in a single frame of the film about the single mother of two, fresh from a year in jail, trying to rebuild her life.

Turns out, the Academy Award-winning actress had co-written the song Glasgow, which supplies the film’s emotional climax and is already receiving some Oscar buzz.

Ms. Steenburgen’s shift to songwriting was not something she nor anyone else expected. After all, most people who go in for routine arm surgery wake up exactly the same. Ms. Steenburgen, and no one knows why, woke up after surgery with her brain consumed by music. She heard it, felt it, breathed it. Literally, every thought and interaction was now processed as music.

“She had trouble sleeping,” her husband Ted Danson remembered of the onset, about a dozen years ago. “We’d be driving and there would be a long silence. I’d wonder, have I upset her? Or we’d pass a street sign, and she’d say, ‘Turn around, I need to see that.’ It was Lost Love Lane.”

And yet Mr. Danson had faith in this altered state.

Ms. Steenburgen sought out the best musical support she could find, beginning on the Vineyard. Mike Benjamin recalled the first tentative outreaches from her, their voicemail song snippets going back and forth. Working together, Mr. Benjamin helped shape her early songwriting efforts into songs that transcend mere ideas and hold up. Along the way, he found a partner with different skills who more than held her own, one who could draw on her Southern roots and acute sense of detail from researching acting roles.

“One winter, it seemed like there was one after another,” Mr. Benjamin said. “You looked at my hard drive and there were over 40 tunes from that winter of 2008, 2009.”

“She wanted to do the work and she did the work,” he added. “She put in the time, and wasn’t afraid of it. Early on, I filled in a verse to something we were writing, and she said, ‘I need to flesh these out on my own, because it’s really personal. But it’s also that people won’t believe me.’ She understood that challenge.”

Ms. Steenburgen remembers the time fondly. “I loved going over to his little shack behind his house. It’s so perfectly creative, and always feels like there had been musicians sleeping on the coaches, playing music into the night.”

With lead actor from Wild Rose, Jessie Buckley. — Amanda Lim

She continued to hone her craft in Nashville with some of the city’s most exacting writers.

“Everybody will write with you maybe once, out of curiosity or courtesy,” Ms. Steenburgen said. “But just about everybody I write with is half my age and all they care about is, ‘Will we get a good song.’ If we don’t, I’ll never hear from them again.”

She pauses for a moment, calling from her trailer on a break from dance rehearsals for the series Zoey’s Extraordinary Playlist, weighing what she’s about to say. Never one to brag, she is willing to speak her truth. “I’m very protective of this. I don’t want it to be trivialized.”

She laughs, echoing the inherent disbelief.

“It’s, you’ve told us who you are, you’re an actor. . . Now what is this? It must be a hobby or a vanity. But what I love if this [Oscar nomination] should happen, then people will know that this isn’t just something I do, but it’s something to take seriously.”

Wild Rose tells the story of the character Rose-Lynn, played by Jessie Buckley. Rose-Lynn is a foul mouthed wild child of 23 with two kids, looking for escape as much as dream fulfillment.

“[Rose-Lynn] was just a mess, so selfish and never stopped being selfish, but you couldn’t help loving her,” Ms. Steenburgen said. “I loved how Tom Harper [the director] never let Jessie try to ingratiate herself as a character. And she was so brave in her portrayal. She neglected those children, it felt at times like she was an abusive parent and she doesn’t ask us to forgive her.”

In Ms. Steenburgen’s Nashville living room, she and her co-writers Kate York and Caitlyn Smith talked about the dream, the reality, the vertigo it causes.

“We thought about all of it, because this song is the first thing you see after she got to Nashville,” Ms. Steenburgen said. “We all know what that means in different ways, because we all went to Nashville too and we all went home.”

Ms. Smith remembered hearing those snippets from the script, the way it framed the song. “The struggle of having this gnawing voice in your ear, calling you to something bigger. . . calling you to get out and try something so you don’t die wondering. I got it, her wild heart.”

“[Glasgow] is the story of more people than just Rose-Lynn or the three of us,” Ms. Steenburgen offered. “It has to be the story not of defeat, but the idea that there’s something greater than El Dorado or Oz with its streets of gold.

“She talked so much about other people’s songs, this had to be the first song she wrote. It’s a song only Rose-Lynn could write, a gigantic love letter to her mother, her children, that community she pushed away because she thought there was something better. We called it Glasgow because it was what she was pushing away, but ultimately pulling her back as the place that really mattered — and she figures it out.”

Like Dorothy, Rose-Lynn figures it out. For Ms. Steenburgen, whose gypsy life takes her around the world acting, home is often in the music as much as in the hearts of her husband, children and friends. Whether she gets the Oscar nod or not, she will continue to write.

Though no one could have seen it coming, Mr. Danson thrills to the reality of his wife’s “willingness to say yes to life. She’s learned so much from this non-stop music in her brain. She went from zero to 100 when life presented her with this moment. I would have said, ‘Oh, I can’t.’ Not Mary.”