“TRAINSPOTTING” was the best British film of the 1990s. Based on the novel of the same name by Irvine Welsh (a book one reviewer said deserved to sell more copies than the Bible), it told the interlaced stories of young working-class men from Leith, a then-rough area east of Edinburgh. “Trainspotting” made a star of Ewan McGregor, and showcased the vivid and frenetic style that Danny Boyle, the director, would use in later films like “Slumdog Millionaire”.

Upon its release in 1996, some critics claimed that “Trainspotting” glamorised drugs. It was an odd thing to say about a film that showed, in graphic detail, the effects of a heroin overdose as well as its withdrawal symptoms. It showed the cold corpse of a baby that had died as a result of neglect by its addict parents. One character, Tommy, dies from AIDS after contracting HIV from sharing an infected needle. True, “Trainspotting” showed a few highs as well as the many lows. But only a Puritan would think it made light of the heroin and HIV epidemic that swept through Edinburgh in the 1980s.

That “Trainspotting” was set in the 1980s is often forgotten. Released into the milieu of Britpop and New Labour, the film is seen as emblematic of the “Cool Britannia” years when British popular culture swaggered its way back into relevance. That is certainly true. “Trainspotting” did the world’s cinemagoers a service by showing that a British film could be successful without having to cast Hugh Grant. It gave lives—real, witty, complex, lives—to those dismissed as deadbeats. The hedonism and aspiration of its characters chimes with the songs of Oasis. The famous coda in which Mark Renton, the protagonist played by Mr McGregor, says he will “Choose Life” would have made him a target voter for Tony Blair’s revival of the British Labour party.

But while the tone of the film reeked of the 1990s its characters came of age in the previous decade. They listen to Iggy Pop, not Blur or Pulp. They are children of Thatcher, not of Blair. Diane, with whom Renton has sex before realising that she is a schoolgirl, tells him that “the world is changing, music is changing, even drugs are changing.” Even then Renton and his pals had a sense of time slipping away.

That is worth remembering when considering “T2 Trainspotting”, which is loosely based on “Porno”, Mr Welsh’s follow-up novel from 2002. In the sequel, rather than avoid the past, Mr Boyle has his characters haunted by it. Scenes deliberately ape those of the first film: Renton runs on a treadmill (rather than down a street); Francis Begbie re-enacts a violent encounter. Wistful chords of songs from the first film’s soundtrack add to the mood of a time that can be imagined but not returned to. “You live in the past,” Renton is told. And so too do those watching. Mr Boyle toys with our desperation for this film to match the first. It does not; but it is great.

The plot is simple. After 20 years in Amsterdam choosing life (or at least a job in “stock management solutions”) and not taking heroin, Renton has returned to Edinburgh. There live one friend (Spud, who is still using), one frenemy (Sick Boy, a cocaine addict who aspires to be a pimp) and one enemy (Francis Begbie, a sadistically violent criminal on the run from prison). It is the first time he meets them since running off with £12,000 from a drug deal two decades ago. In part because he fancies Veronika, a Bulgarian wannabe-madam playing with Sick Boy’s affection, Renton decides not to return to Holland. Instead he agrees to help Sick Boy win a European Union grant to “refurbish” (convert into a brothel) a down-at-heel local pub. But has Sick Boy really forgiven him? And will the seething Begbie find him?

Like any homecoming there are moments when life and friendship feel like they once were. These now middle-aged men have fleeting moments of youth-like abandon. After a successful (and hilarious) robbery of members of a sectarian Protestant club in Glasgow it seems as if Renton and Sick Boy have made up. They even persuade the EU that the Port Sunshine boozer must be part of the gentrification of Leith.

But the high wears off, and their powers—financial, sexual and emotional—reach new ebbs. They watch as a new generation seem to have it better than they did; their choices are only between “Facebook, Twitter, Instagram”. In their own ways the characters slowly realise that they have made irreversible choices. They may want to revisit them but they cannot. It hurts.

Although there are a few raucous scenes, “T2 Trainspotting” does not shock like the original. How could it? At times Mr Boyle and John Hodge, the screenwriter, try too hard to stitch the two together. When Renton launches into a new “Choose Life” monologue it feels overly contrived. But “T2 Trainspotting” is still a thoughtful, funny and moving piece of cinema. It demonstrates that the most addictive thing of all is the past.

“T2 Trainspotting” is screening in Britain now and in America from March 17th