LONDON — Andrew Scott, who is Jim Moriarty in “Sherlock” and is soon to be seen as Denbigh in James Bond movie “Spectre,” has joined the cast of Philippa Lowthorpe’s feature film adaptation of Arthur Ransome’s adventure story “Swallows and Amazons.” Scott, whose other movie credits include “Pride,” will play a secret agent — by the name of Lazlow — in pursuit of the reclusive and enigmatic Jim Turner (Rafe Spall), inspired by Ransome’s own life as a spy.

In the novel “Swallows and Amazons,” Ransome based the character of Turner on himself as a novelist. The filmmakers behind this new adaptation have been inspired by Ransome’s secret life as an agent for the British intelligence service MI6, and based Turner on Ransome the spy. The truth about Ransome’s role as a secret agent, whose code name was S.76, was revealed 10 years ago when the British government released its files on Ransome’s activities in Russia between 1914 and 1937.

The story follows four children dreaming of an escape from the tedium of a summer holiday with their mother. When finally given permission to camp on their own on a remote island in the middle of a vast lake, they are overjoyed. But when they get there they discover they may not be alone… As they battle for ownership of the island, they learn the skills of survival and the value of friendship, which helps prepare them for the real danger they must face from the adult world.

One of the attractions of Scott’s depiction of Moriarty in “Sherlock” was a genuine sense of menace and threat, but the character he plays in “Swallows and Amazons” will be very different, he told Variety on Monday. “It’s a very different kettle of fish altogether. He’s a very charismatic character, and there is humor and warmth in the character,” he said. “It’s a great part; it’s very witty. It’s a very attractive character to play, so I’m delighted to be on board.”

But what drew him to the project most was the story. “The chief reason I’m on board is because I love the storyline. That’s the thing that attracts me to any project — a great script and a really good story,” he said.

One theme of the story is about how appearances can be deceptive. “It’s about how adults can appear a certain way, but appearances, the way people behave, and what we’ve been told about people are not necessarily true, and children have to learn that for themselves,” he said.

Actors, like spies, need to pretend to be something they are not and say things they don’t believe, but Scott does not think he would make a good spy in real life, even though he plays one in the film. “There are certain similarities between acting and being a spy,” he said. “But I think there’s a great myth because actually most actors are terrible, terrible liars. What with doing Bond for the past six months and being in that world, I’ve come to realize it’s a very different world, contrary to what people might think.”

It’s the first time he’s appeared in a movie made for children. “I’m delighted that this is a film that my godchildren can come and watch, because some of the stuff I’ve done before has been a bit adult themed,” he said.

“I don’t think films made for children need be any less accomplished than those made for adults: just look at ‘Paddington’ last year, which is such a beautiful film. Standards have to be very high because children have very good instincts for what is believable and relevant,” he said.

Scott likes to take on a variety of projects, and intends to juggle stage work, TV and movies, as he’s done so far. “I love to do as many different things as possible,” he said. “I’ll keep it the way I’ve been doing it so far. That’s my idea of success as an actor. I’m very lucky to traverse the three things, and even do a bit of radio, and as many things as possible, because that’s the fun of it. It’s a bit of a juggle this year, but it’s really exciting,” he said.

Scott joins the cast alongside Spall (“BFG,” “I Give It a Year”) as Turner (aka Captain Flint), Kelly Macdonald (“No Country for Old Men,” “Boardwalk Empire”) as Mrs. Walker, Gwendoline Christie (“Game of Thrones”) as Mrs. Blackett, Jessica Hynes (“Up the Women,” “Shaun of the Dead”) as Mrs. Jackson, and Harry Enfield (TV series “Bad Education,” “Kevin and Perry Go Large”) as Mr. Jackson.

The Walker and Blackett children from the Ransome story will be played by young breakthrough stars, including Dane Hughes as John Walker, Orla Hill as Susan Walker, Teddie-Rose Malleson-Allen as Tatty Walker, Bobby McCulloch as Roger Walker, and Seren Hawkes and Hannah Jayne Thorp as Nancy and Peggy Blackett.

The film began principal photography in the Lake District, North-West England, on June 21, and will be shooting over the summer in the Lake District and Yorkshire.

The film marks the feature debut of Lowthorpe, whose TV credits include “Call the Midwife” and “Jamaica Inn.” The screenplay is by Andrea Gibb (“Dear Frankie”).

BBC Films and the BFI developed the project with Harbour Pictures Productions and are also supporting production. HanWay Films is handling worldwide sales. The film will be distributed in the U.K. by Studiocanal. It received finance from Screen Yorkshire’s Yorkshire Content Fund, The Electric Shadow Company and Maiden Investments.

Nick Barton of Harbour Pictures, Nick O’Hagan, and BBC Films’ Joe Oppenheimer are producers. Executive producers are Christine Langan of BBC Films, the BFI’s Natascha Wharton, Studiocanal’s Danny Perkins and Jenny Borgars, Screen Yorkshire’s Hugo Heppell, Alexa Seligman and John Jencks of Electric Shadow, Peter Watson of HanWay Films, Steve Milne and Ian Maiden.