In the small town of Blithe Hollow, Massachusetts, Norman Babcock (Kodi Smit-McPhee) is an 11-year-old boy who speaks with the dead, including his late grandmother (Elaine Stritch) and various ghosts in town. Almost no one believes him and he is isolated emotionally from his family while being ridiculed by his peers. His best friend, Neil Downe (Tucker Albrizzi), is an overweight boy who is bullied himself and finds in Norman a kindred spirit. During rehearsal of a school play commemorating the town's execution of a witch three centuries ago, Norman has a vision of the town's past in which he is pursued through the woods by townsfolk on a witch hunt. Afterward, the boys are confronted by Norman's estranged and seemingly deranged uncle Mr. Prenderghast (John Goodman) who tells his nephew that he soon must take up his regular ritual to protect the town. Soon after this encounter, Prenderghast dies from a sudden stroke. During the official performance of the school play Norman has another vision, creating a public spectacle of himself which leads to his father Perry (Jeff Garlin) grounding him. His mother Sandra (Leslie Mann) tells him that his father's stern manner is because he is afraid for him. The next day, Norman sees Prenderghast's spirit who tells him that the ritual must be performed with a certain book before sundown that day; then making him swear to complete the task, Prenderghast's spirit is set free and crosses over. Norman is at first reluctant to go because he is scared but his grandmother tells him it is all right to be scared as long as he does not let it change who he is. Norman sets off to retrieve the book from Prenderghast's house (having to take it from his corpse).
He then goes to the graves of the five men and two women who were cursed by the witch, but finds that the book is merely a series of fairy tales. Alvin (Christopher Mintz-Plasse), a school bully, arrives and prevents Norman from reading the story before sundown. Norman attempts to continue reading from the book, to no effect. A ghostly storm resembling the witch appears in the air, summoning the cursed dead to arise as zombies, who chase the boys along with Norman's 17-year-old sister, Courtney (Anna Kendrick) and Neil's older brother, Mitch (Casey Affleck) down the hill and into town. Having realized that the witch was not buried in the graveyard, Norman contacts classmate Salma (who tells them to access the Town Hall's archives for the location of the witch's unmarked grave) for help. As the kids make their way to the Town Hall, the zombies are attacked by the citizenry. During the riot, Norman and his companions break into the archives but cannot find the information they need. As the mob moves to attack Town Hall, the witch storm appears over the crowd. Norman climbs the Hall's tower to read the book, in a last-ditch effort to finish the ritual, but the witch strikes the book with lightning, hurling Norman from the tower and deep into the archives.
Unconscious, Norman has a dream where he learns that the witch was Agatha Prenderghast (Jodelle Ferland), a little girl of his age who was also a medium. Norman realizes that Agatha was wrongfully convicted by the town council when they mistook her powers for witchcraft. After awakening, Norman encounters the zombies and recognizes them as the town council who convicted Agatha. The zombies admit that they only wanted to speak with him to ensure that he would take up the ritual, to minimize the damage of the mistake they made so long ago. Norman attempts to help the zombies slip away so they can guide him to Agatha's grave, but is cornered by the mob. Courtney and the kids confronts the crowd and convinces them to back off, arguing that their rage, fear, and misunderstanding make them no different than the cursed townsfolk from long ago. Judge Hopkins (Bernard Hill) guides Norman's family to the grave in a forest. Before the grave is reached, Agatha's magical powers separate Norman from the others. Norman finds the grave and interacts with Agatha who has become a vengeful spirit/poltergeist in the spirit dimension, determined to stop the cataclysmic tantrum she has been having over the years. She asks him to leave her be, but Norman holds his ground, telling her he understands how she feels as an outcast. Norman endures her assault and eventually convinces her that her vengeance is accomplishing nothing and persuades her to stop. Norman tells her that there must have been someone who was kind to her.
Agatha recalls happy memories with her mother. At last, having finally encountered someone who understands her plight, she is able to find a measure of peace and cross over to the afterlife. The storm dissipates, and she and the zombies all fade away. The town cleans up and regards Norman as a hero. In the end, Norman watches a horror film with the ghost of his grandmother and his family, who have grown to accept Norman for who he is.

Question: When does Norman have a vision in which he is pursued?
Answer: During rehearsal of the school play