On a recent afternoon, the actor Greg Tannahill sat perched atop a London rooftop, one leg extended, one arm outthrust. A pair of carpenters would then whisk Tannahill from his rooftop and into a nursery. And then out of it. And then back in again. A window frame would come free. Tannahill, now jerked upside down, would mewl and scream and clamber down a wall. Once he finally righted himself, the flight harness would wrench him upside-down again.This breathless, silly sequence lasted less than a minute and ended when Tannahill, playing an actor cast as Peter Pan in an ill-starred kiddie production, finally stands up straight and delivers the line: “Thank heavens I didn’t wake the children.”The routine requires split-second precision and the seamless cooperation of actors, flight operators and stage managers. To make it work and to make it safe (there is an open flame on set!), the creators and crew members of “Peter Pan Goes Wrong,” the spry, slapstick comedy that is scheduled to open at Broadway’s Ethel Barrymore Theater on April 19, have spent dozens of hours (maybe hundreds of hours, counts differ) honing this one bit.“Peter Pan Goes Wrong” is the second Broadway production, following the Agatha Christie- adjacent “The Play That Goes Wrong,” in 2017, from the theater company Mischief. Founded by three former drama school roommates — Henry Lewis, Jonathan Sayer and Henry Shields — Mischief specializes in farcical deconstructions of established genres. Each new play is putatively the work of the Cornley Polytechnic Drama Society, a troupe of overambitious amateur thespians. Whenever the Cornley players take the stage, something inevitably goes awry. A lot of somethings. Mischief’s fascination is with the things (and people) that go bump in the night. People like Tannahill.Backstage at the Ethel Barrymore Theater: Richard Force, a carpenter, helping Tannahill into his harness.Dolly Faibyshev for The New York Times“I’ve gained a bruise or two in rehearsal,” said Tannahill, once he had retired to his dressing room. “But you’ve got to break a few eggs to make a lovely omelet.” He then clarified that he hadn’t actually broken anything.‘Acclimate to the terror’I visited the Barrymore a week before the show’s first preview performance because I wanted to see the work that went into putting even one gag together. “Hours go into generating just 10 seconds,” Sayer told me.It was late afternoon, just before the dinner break, and the auditorium was littered with binders, monitors and makeshift desks. The atmosphere was one of controlled chaos, but no one seemed especially tense. (Many of the company’s members studied together at the London Academy of Music and Dramatic Art.) Not even Tannahill, though he did ask, good-naturedly, for a moment to catch his breath before the carpenters swung him in again.“Just so I can acclimate to the terror that is that moment,” he said.That moment has been in the works for about 10 years, ever since “Peter Pan Goes Wrong” first opened at the Pleasance, a small theater in North London. Mischief had chosen a children’s show as the follow-up to “The Play That Goes Wrong” for two reasons. First, these shows have so many rules and conventions ripe for rupture. “You can’t really get more serious than a show that is intended for children,” said Henry Shields, as he and his collaborators speed-ate a dinner of pasta and salad. “The moral standard of these shows, it is extremely high.”The second reason was the flying rig. With characters suspended high above the stage floor, what could possibly go wrong? Quite a lot.When the show debuted, at the Pleasance, the company couldn’t afford luxury gear. The rented rig had no counterweight, so when they wanted to lift Tannahill, who originated the role of the actor playing Peter Pan, a crew member had to jump off a stepladder. To have Tannahill enter at the appropriate speed, a couple of actors would hold his feet, pull him back and let him go.Honing a sequence: Jonathan Sayer, one of the founders of the Mischief theater company, compared their process to stop-motion animation, because a new movement or gesture has to happen nearly every second.Dolly Faibyshev for The New York Times“The low-tech version of the show was much more dangerous,” Shields said. “I mean, it was safe, we took care, but there were more bruises.”In this low-tech version, things actually did go wrong, unscripted things. At one point, a screw fell out and a door broke away, jamming the revolving stage just minutes before curtain. At another performance, a dummy version of Peter Pan fell to the floor prematurely. (“Don’t worry,” Tannahill ad-libbed. “That’s just the other dead Pan.”) One night, Sayer, playing one of the children, forgot to loosen a button on his costume. When his own rig jerked up, it choked him.“I remember being very out of breath and quite shaken and looking up expecting to see you all looking very concerned,” Sayer recalled. “Everyone had tears rolling down their faces with laughter.”The company now takes rehearsals and personal safety just a bit more seriously. “With age and experience comes much more care,” Sayer said. “When you’re 21, you say, ‘Let’s just go for it!’ Now, there’s a lot of poring through everything at an extreme level of detail to get it right and to make sure that we’re safe and well and happy.” (He and his collaborators are now seasoned men of 34.)Mischief managedFor a “Goes Wrong” play to work, the production has to chart an exact course between mayhem and control. Too much polish and it isn’t funny. “Especially on a big Broadway show, people are so hard-wired to be like, ‘Well, this is how it’s done. This is how we’ll make it clean, neat, tidy.’ You’re quite often trying to unpick those things. Like, ‘No, no, let that moment be messy. Let the shirttails hang out,’” Lewis said.But too little refinement and the jokes don’t fly. If the doors slam — and slam and slam — but the story isn’t told, the audience won’t laugh. With each new production, the director, Adam Meggido, includes at least one rehearsal in which everything goes right. “You need to be able to do the thing and to have total control over it before you can start to undercut it,” Sayer said. “You’ve got to make sure the story of ‘Peter Pan’ is being told before you start to rip it up a little bit.”Matthew Cavendish, who plays Max, in bunk beds that collapse, naturally.Dolly Faibyshev for The New York TimesAnd then, second by second, joke by joke, the ripping begins, in a process that Sayer compared to stop-motion animation, because a new movement or gesture has to happen nearly every second. “Comedy is hard,” Shields said. “Jokes are hard. You have to be very precise.”Still, that precision has to allow for differences in the layout of each new theater and for the addition and subtraction of actors and understudies, who have to be afforded the space to play the roles in their own ways, even while hitting every line and mark. Besides, Lewis, Sayer and Shields have never met a joke that they didn’t believe they could eventually improve. Ten years on, they’re still tweaking, refining and adding new bits. “You’re never finished writing comedy,” Shields said, sounding slightly exhausted. (At one point he had described Mischief’s style as “a bottomless pit of comedy.”)The fine-tuning ends only during the technical rehearsals, when any further changes would give the designers, board operators and stage managers conniption fits. I found them a few days before that, during what Lewis described as “that fun, exhilarating part of the process where we’re trying to get those last few changes through.”Where the magic happensAn assistant stage manager led me across a confetti covered set to a narrow backstage area that magically held a half-dozen people. The carpenters stood behind a bank of monitors. One grasped the ropes that controlled Tannahill’s horizontal travel; the other his vertical axis. “Peter Pan Goes Wrong” has upgraded since its Pleasance days. The rig now came courtesy of Flying by Foy, the industry leader. (In a neat bit of symmetry, Peter Foy, of Flying by Foy, designed the rig for Mary Martin’s celebrated “Peter Pan.”) It would take both of them, three stage managers and an offsite flying manager to guarantee Tannahill a smooth journey. Which is to say, one in which every bump and inversion is intentional.Tannahill says he enjoys all the pranks, even being turned upside-down. “It’s quite therapeutic,” he said.Dolly Faibyshev for The New York TimesTannahill claimed to enjoy all of it, even the moments in which he was turned upside-down. “It’s actually quite nice,” he said. “Gets the blood circulation going in a different direction. It’s quite therapeutic.”At rehearsal, he oriented himself precisely on a roof. At a cue from Tannahill, a raised hand, the operators swung him through the window. This was the carpenters’ 20th time with the sequence, maybe the 30th, and it ran without a hitch, though without the necessary force.“Can you slap him into the wall?” Sayers said to the carpenters. “He used to really thwack into the wall.” The sequence had to look out of control while the actual control remained perfect. If Tannahill seemed to be in real danger, the audience would feel too anxious to chuckle. But if he came in too slow, they wouldn’t laugh either.They tried it again. This time Tannahill did smack into the wall. The wrong wall. The sequence reset. “Because that happened in rehearsal, it was very controlled,” Tannahill later reassured me. “It didn’t give me a bruise straightaway.”The third time, the sequence, in fairy-tale fashion, went just right. When Tannahill flipped upside-down for the second time, the cast and crew cackled. How did it feel to have finally nailed the timing and the trajectory, to have his colleagues laugh at his discomfort?“It feels great,” Tannahill said. “It makes all the bruises worth it.” More