Dr. Malcolm Crowe, a child psychologist in Philadelphia, returns home one night with his wife, Anna, after having been honored for his work. Anna tells Crowe that everything is second to his work, and that she believes he is truly gifted.
Just then, a young man appears in their bathroom, and accuses Crowe of failing him. Crowe recognizes him as Vincent Grey, a former patient whom he treated as a child for hallucinations. After Crowe realizes he did fail him, Vincent shoots his former doctor before killing himself.
The next fall, Crowe begins working with another patient, 9-year-old Cole Sear, whose case is similar to Vincent's. Crowe becomes dedicated to the boy, though he is haunted by doubts over his ability to help him after his failure with Vincent. Meanwhile, he and his wife seldom, if ever, speak or do anything together. Crowe feels he must help Cole in order to rectify his failure to help Vincent and reconcile with his wife. Cole's mother, Lynn, who truly loves him, worries about his social stamina, especially after seeing signs of physical abuse. Cole eventually confides his secret to Crowe: he sees ghosts, who walk around like the living unaware they are dead.
At first, Crowe thinks Cole is delusional and considers dropping him. Remembering Vincent, the psychologist listens to an audiotape from a session with Vincent when he was a child. On the tape, when Crowe leaves the room, and then returns, Vincent was crying. Turning up the volume, Crowe hears a weeping man begging for help in Spanish, and now believes that Cole is telling the truth and that Vincent may have had the same ability. He suggests to Cole that he should try to find a purpose for his gift by communicating with the ghosts and perhaps aid them with their unfinished business. At first, Cole is unwilling since the ghosts terrify and sometimes even threaten him, but he finally decides to do it.
Cole talks to one of the ghosts, Kyra Collins, a young girl who recently died after a chronic illness. He goes with Crowe to her funeral reception at her home, where Kyra directs him to a box holding a videotape, which he then gives to her father. The tape shows Kyra's mother putting a cleaning fluid in her soup. By proving she was a victim of Munchausen syndrome by proxy, Cole has saved Kyra's younger sister, the mother's next victim.
Learning to live with the ghosts he sees, Cole starts to fit in at school and gets the lead in the school play, which Crowe attends. The doctor and patient depart on positive terms and Cole suggests to Crowe that he should try speaking to Anna while she is asleep. Later, while stuck in a traffic jam, Cole confesses his secret to his mother, saying that someone died in an accident up ahead and he knows because the person is right next to him. Lynn does not see the recently deceased, but Cole sees a woman cyclist with blood dripping down her face. Although his mother at first does not believe him, Cole proves his ability to her by talking about how his grandmother visits him. He describes how his grandmother saw his mother in a dance performance, even though Lynn thought her mother was not there. He further relays the answer to a question his mother privately asked at her mother's grave. When Cole says that his grandmother feels proud of Lynn, his mother tearfully accepts the truth and they hug each other.
Crowe returns home, where he finds his wife asleep with their wedding video playing. While still asleep, Anna asks her husband why he left her, and drops Crowe's wedding ring, which he suddenly discovers he has not been wearing. He remembers what Cole said about ghosts and realizes that he was actually killed by Vincent that night, and was unknowingly dead the entire time he was working with Cole. Because of Cole's efforts, Crowe's unfinished business   rectifying his failure to understand and help Vincent   is finally complete. Crowe fulfills the second reason he returned: to tell his wife she was never second, and that he loves her. His goal complete, he is free to leave the world of the living.
Output: When does Cole tell Crowe to go talk to Anna?