During the dozen or so years Tameson Duffy struggled to become a Hollywood screenwriter, working as a dog walker or giving out drink samples at Whole Foods to pay the bills, she did not think of giving up once.

She thought of it many, many times.

Maine native Tameson Duffy, a writer for the long-running ABC medical drama “Grey’s Anatomy,” wrote the episode airing Thursday. Travis Tanner photo

“Oh, absolutely, all the time. That was the biggest challenge, to keep finding your way out of disappointment and rejection,” said Duffy, 48, now a writer with the long-running ABC medical drama “Grey’s Anatomy.” “I would think about how I left Maine, I had all this student loan debt, and I was working some stupid job.”

Duffy will literally get to see the results of her resilience Thursday at 8 p.m. when the first “Grey’s Anatomy” episode she penned airs. She’s been a staff writer, contributing to all the episodes, since last spring. She still gets emotional talking about the day she was offered the job to join the show for its 14th season.

“I freaked out. I said, ‘Oh my God. What? Are you – ‘ and then I got teary,” said Duffy.

Duffy was a fan of “Grey’s Anatomy,” and especially the writers, way before she ever worked with them. She said she always admired how relatable the characters seemed to be and the “humanity and humor” conveyed in the writing.

“These were people who were saving lives, but their own lives were falling apart,” Duffy said. One of the show’s original stars was Patrick Dempsey, originally from Lewiston and known on the show as “McDreamy,” but he left “Grey’s Anatomy” in 2015 before Duffy joined it.

During a TV writer’s strike about 10 years ago, Duffy decided to join a picket line that included “Grey’s Anatomy” writers and staff, to show her support for them. She was living in Los Angeles, having earned a master’s degree in screenwriting at UCLA a couple years earlier.

Ellen Pompeo in a scene from the episode of ABC’s “Grey’s Anatomy” airing Thursday at 8 p.m. Maine native Tameson Duffy is a writer with the show and wrote this episode. ABC/Mitch Haaseth photo

As she was leaving the picket line, one of the “Grey’s Anatomy” people started talking with her. It turned out to be Krista Vernoff, a former writer on the show who is now the series’ show runner, the person who has the final say on scripts and production.

Duffy happened to know someone who knew Vernoff, and the two stayed in touch. Duffy eventually worked as a research assistant helping Vernoff write a fitness book. Over the years, Vernoff recommended Duffy for some writing jobs and read scripts Duffy was working on.

Then, last year, Vernoff invited Duffy to pitch stories for a “Grey’s Anatomy” episode. She wrote that episode – the one that’s airing Thursday – as a freelancer, but it convinced Vernoff to hire her as one of the show’s 11 writers. There are also three medical doctors on staff, to help with medical details in the scripts.

Duffy got interested in acting as a youngster, partly because she’s always been interested in people’s stories. After graduating from York High School and studying at the University of Maine, she acted while working other jobs for more than a dozen years. She lived in Portland and was in several productions of the Mad Horse Theatre ensemble. But eventually, she felt that acting and the roles available to her as a woman were too limiting. “I was either a virgin, a mother or a hooker, and I got really frustrated,” said Duffy. “I decided I wanted to write.”

She got her undergraduate degree from the University of Southern Maine and then applied to the screenwriting program at UCLA, and got in. She drove out to California with her mother. Besides more menial jobs, she worked in the industry as an assistant to writers, actors and show runners. She also wrote some film shorts.

Each episode of “Grey’s Anatomy” is written by one writer, but all the other writers contribute, sitting in a room with a white board, jotting down ideas and helping to make characters come to life, Duffy said. Writers might have to turn out a script in two days or have two weeks to do it, she said. The group of writers help plan out all the stories for a season.

“We ask ‘What is Meredith (Grey, the lead character) going to face? What are the relatable problems, challenges we can give these characters?” Duffy said.

Duffy said she couldn’t talk specifically about what happens in the episode she wrote. But ABC press materials describe it this way: “Meredith tries to learn more about Marie Cerone’s history with her mother. Meanwhile, Jo is applying for fellowships around the country and it throws Alex for a loop: and Tom Koracick helps April acknowledge her crisis of faith.”

Kelly McCreary and Jesse Williams in a scene from an episode of ABC’s “Grey’s Anatomy” airing Thursday at 8 p.m. Maine native Tameson Duffy, now living in California, wrote the episode. ABC/Mitch Haaseth

That’s a lot to keep straight. Especially when some of the characters, like Meredith, have 14 seasons’ worth of life events that viewers have already seen. Some of the writers are longtime veterans too, and they help sort things out, like telling a writer to delete something if it already happened to the character.

Duffy will watch the episode she wrote with a friend who is coming from Maine, and with her wife, actress and comedian Frances Nichols. Nichols was cast this season as Nurse Karen on “Grey’s Anatomy.” As proof that Hollywood is a small town, Duffy and Nichols got their jobs on the show independently of each other.

As the writer of Thursday’s episode, Duffy got to be at the filming, in a crucial role. She said, unlike films where the director’s vision clearly takes precedent, a TV show’s director takes advice and notes from the writer and passes them on to the actors. If a scene needs to be funnier or more emotional, the writer will point that out, Duffy said.

“A challenge of the job is staying true to the characters. You need them to go through a real human journey,” said Duffy.

Ray Routhier can be contacted at 791-6454 or at:

[email protected]

Twitter: @RayRouthier