At its best, and “T2” is mostly at its best, there’s a kind of joy about it, and a joy in watching it, of sitting back and witnessing a succession of beautiful and clever surprises, of never knowing what’s coming next, and of always having that next thing be something better than you might have ever guessed. The first “Trainspotting” was released in 1996, an unexpected hit about heroin addiction among Scottish working-class youths. It’s a triumphant image of health, but Boyle undercuts this immediately with tiny flashbacks to Renton as a youth, suggesting the lingering presence of bad memories. Begbie (Robert Carlyle), an explosive maniac, is in prison, screaming at and terrifying his lawyer. In a scene both laugh-out-loud funny and unbelievably grotesque, he is in the process of suffocating himself with a plastic bag when Renton comes to visit him. The script by John Hodge, loosely based on two “Trainspotting” novels by Irvine Welsh, has a slapdash feeling, as though one thing were following another, with no plan or reason. Hodge gives scenes a solid grounding, which allows Boyle to take flight. Renton visits his father, and they talk in the kitchen about Renton’s dead mother. Later in the film, Boyle starts a sex scene to the accompaniment of the 1979 Blondie song “Dreaming,” which never sounded so good. Intuiting that the audience doesn’t want the song to stop, Boyle fills the screen with a series of sights and incidents involving other characters, such as Spud’s renovation of a bar. No, “T2” is not a great film, but its pleasures are great — and so rare and accomplished that they raise “T2” to a level approximating greatness.