In Toronto, 22-year-old Scott Pilgrim is a bass guitarist in Sex Bob-Omb, a floundering garage band. To the disapproval of his friends, he is dating Knives Chau, a high school student. Scott meets an American Amazon.ca delivery girl, Ramona Flowers, having first seen her in a dream, and loses interest in Knives. When Sex Bob-Omb plays in a battle of the bands sponsored by record executive G-Man Graves, Scott is attacked by Ramona's ex-boyfriend Matthew Patel. Scott defeats Patel and learns that, in order to date Ramona, he must defeat the remaining six evil exes.
Scott breaks up with Knives, who blames Ramona and swears to win him back. Scott defeats Ramona's second evil ex, Hollywood actor and skateboarder Lucas Lee, by tricking him into performing a dangerous stunt. He defeats her third ex, vegan Todd Ingram, who is dating Scott's ex-girlfriend, Envy Adams, by tricking him into drinking dairy. He defeats Ramona's fourth ex, Roxy Richter, by prodding the spot behind her knee, which Ramona tells him is her weak point.
Scott becomes upset with Ramona's dating history, and Ramona breaks up with him. At the next battle of the bands, Sex Bob-Omb defeats Ramona's fifth and sixth evil exes, twins Kyle and Ken Katayanagi, earning Scott a 1-up. Ramona gets back with her seventh evil ex, Gideon, also known as G-Man Graves, the sponsor of the event. Sex Bob-Omb accept Gideon's record deal, except for Scott, who leaves the band in protest.
Gideon invites Scott to his venue, the Chaos Theater, where Sex Bob-Omb is playing. Resolving to win Ramona back, Scott challenges Gideon to a fight for her affections, earning the "Power of Love" and a sword. Knives fights Ramona over Scott, and Scott accidentally reveals that he dated them concurrently. After Gideon kills Scott, Ramona visits him in limbo and reveals that Gideon has implanted her with a mind control device.
Scott uses his 1-up to restore his life. He makes peace with his friends and challenges Gideon again, this time for himself. He gains the "Power of Self-Respect" and disarms Gideon with the sword it grants him. He apologizes to Ramona and Knives for cheating on them, and Scott and Knives join forces to defeat Gideon.
Free from Gideon's control, Ramona prepares to leave. Knives accepts that her relationship with Scott is over. At her encouragement, he follows Ramona.

Question: When did Scott leave the band?
Answer: after learning that G-Man used to date Ramona
Alternative answer: When the rest of the band accepted a record deal.