Close to four decades after Bill Murray, Dan Aykroyd, Ernie Hudson and Harold Ramis took on a demonically controlled giant marshmallow man, with memorable results, comes “Ghostbusters: Afterlife” (Columbia).

A somewhat sentimental homage to its two Reagan-era forerunners (and to the memory of Ramis, who died in 2014), the film is a crowd-pleasing gothic comedy. But it’s not a movie for the whole family.

Ignoring Paul Feig’s 2016 reboot, director and co-writer Jason Reitman (son of the kickoff and first sequel’s helmsman, Ivan, here a producer) seeks to return to the franchise’s roots, with the help of some crucial high-profile cameos. He also aims to refresh the action via a youthful protagonist, 12-year-old science geek and lame-joke aficionado Phoebe Spengler (Mckenna Grace).

Soon after the death of her grandfather, Egon (Ramis’ character), Phoebe, her older brother Trevor (Finn Wolfhard) and their cash-strapped single mom, Callie (Carrie Coon) relocate to the remote, dilapidated farmhouse to which Granddad had retreated years before after mysteriously deserting his family. The move is not exactly by choice; the trio has been evicted from their previous dwelling.

Both kids are soon swept up in battling the swarm of evil spirits that Egon, a seemingly eccentric recluse, had long secretly managed to keep at bay. They’re aided by Phoebe’s new science teacher, Gary Grooberson (Paul Rudd), and by the first real friend she has ever made, a classmate who goes by the self-given nickname Podcast (Logan Kim).

Callie, meanwhile, wrestles with the emotional legacy of Egon’s abandonment of her. She also falls for Gary and the two engage in a wry romance.

The script, on which Reitman collaborated with Gil Kenan, strikes a generally jaunty note. Yet some of the jokes are coarse and an off-screen encounter — its moral status admittedly muddled by the weird circumstances under which it’s initiated — is treated as fodder for fun.

Grown-ups, especially older folks who can remember the summer of 1984, will easily handle such material. But they should leave the kids — or is it the grandkids by now? — safely at home.

The film contains frivolous occult elements, implied premarital sexual activity, occasional sexual humor and about a half-dozen instances each of mild oaths and crude expressions. The Catholic News Service classification is A-III — adults. The Motion Picture Association rating is PG-13 — parents strongly cautioned. Some material may be inappropriate for children under 13.

— John Mulderig