Shonda Rhimes from ABC's political thriller "Scandal"

"Scandal" showrunner Shonda Rhimes revealed her writers had been forced to change sections of dramatic dialogue after seeing their lines spoken for real in the US presidential debates.

The ABC political thriller features a presidential race which mirrors the current battle for the Republican and Democratic nominations -- and a White House hopeful in upcoming episodes who bears a striking resemblance to GOP frontrunner Donald Trump.

Asked to comment on the debates -- which have been criticized for their unbecoming tone and Trump's infamous reference to the size of his manhood -- Rhimes obfuscated, saying the process was "its own thing -- you can't make that stuff up."

But she revealed: "We did have some moments where I'd run back to the writers' room the next day and go, 'Hey, there's some dialogue we have to cross out because it's kind of already happened."

Fans at the PaleyFest television festival in Los Angeles were treated to an exclusive preview of the fifth season's next episode, due to air on Thursday, and a panel session involving cast members including Kerry Washington, Tony Goldwyn and Portia de Rossi.

"This week's episode -- I'm glad you loved it. Next week, whoo! If you think the debates you've seen in the real world are fun... " teased Washington, leaving the sentence unfinished.

The cast described how Democrat hopeful Hillary Clinton had paid a surprise visit to the set as Scott Foley, who plays intelligence officer Jake Ballard, was guest-directing an episode.

He admitted being alarmed as a succession of Clinton staff and the former first lady herself passed by as he was wrapping the evening's shoot.

"It was very strange. It was literally the last shot of the night, I had no idea she was going to show up, the camera was rolling and someone said 'hold on, wait, wait, wait.'

"I turned round and said 'What the heck? Come on, everyone wants to go home.' And then three highway patrolmen came through and a documentary film crew came through," Foley told Hollywood's Dolby Theatre.

"And then nine Secret Service members walk out with guns... and then Hillary emerged in this beautiful green (dress) and I thought, 'Oh God!' I didn't know what to do.

"She sat behind me and I said 'Yeah, good -- action!' It was terrifying!"