Walter Mosley was already a bestselling novelist whose Easy Rawlins mysteries became movies (“Devil in a Blue Dress”) when director John Singleton called him to brainstorm with his co-creator Eric Amadio.

Singleton wanted to do a TV series about the crack epidemic in LA. That series, “Snowfall,” is now in its third season on FX (Wednesdays at 10 p.m.) — with Mosley as a consulting producer.

“I knew what was going on in LA. My domicile was in New York, but it was the same thing,” says Mosley, 67. “Me in Harlem, somebody else in Watts. The involvement of the CIA, the police. All that happened without people knowing it. Most Americans believe a policeman wouldn’t jaywalk. You couldn’t be further from the truth.”

‘That is one of the things that crack did. It turned people against each other.’

On “Snowfall,” the tragedy of the crack epidemic is mainly played out in South Central LA, where young Franklin Saint (Damson Idris) becomes a major dealer and bitter enemies with his father figure, Sergeant Andre Wright (Marcus Henderson) of the LAPD.

“It’s like the Civil War, brother against brother, father against son,” Mosley says. “That is one of the things that crack did. It turned people against each other. Nobody thought anything was going to happen. You start out selling marijuana. You eat a lot, have great sex and fall asleep. Crack might be a little more intense, but you don’t expect that crazy, violent addiction. Once it started happening, millions of dollars were there and you had to meet the demand. When you have the support of the CIA, it’s a fait accompli.”

This season, Mosley contributed two scripts, “Cash and Carry,” which aired July 24, and the season’s ninth episode, airing later this summer. He describes scriptwriting as necessarily more collaborative than novel writing.

“They told me during [episodes] six and seven, ‘They need you on 9.’ You’re all working together. It’s wonderful and pedestrian,” he says. “And then you find out that somebody broke their foot and you have to put their limp into the script. It’s like vaudeville.”

Although Mosley is writing dialogue for “Snowfall,” he says he is able to convey the same amount of information that he would in a piece of fiction by including directions such as “Franklin is nervous” in the scripts as well as talking to the actors, directors and wardrobe personnel about the plot.

“You can actually do the same stuff in a script that you do in the novel but the audience doesn’t see it,” he says.

“Snowfall” has been told in real time since the show debuted three years ago, Mosley says, with the third season coming in as the strongest — but he adds that the crack epidemic burned itself out. “You can’t do crack for long,” he says, “That’s not to say it doesn’t have a devastating effect on the community. The show’s about how people whose lives were already on the edge are now completely decimated.”

Mosley, like his colleagues on “Snowfall,” mourned the passing of Singleton in April, when he died of a stroke at age 51.

“Without John, this show wouldn’t exist,” says Mosley, who has two forthcoming books, “Elements of Fiction” in September and “Trouble Is What I Do” in February 2020. “He was everywhere, he knew everyone. He never felt he was better than anyone. He liked to be on set, he worked with everyone. As sad as I am for losing him, I feel John lived a better life than most people.

“He didn’t waste a minute.”