Paul Thomas Anderson has made it his business – and our pleasure – to return to the San Fernando Valley, where he came of age in the 1970s and which has served as his creative muse for most of his career. Like Fellini’s Italy or Scorsese’s New York, Anderson’s Los Angeles is rarefied yet strangely universal – a locale whose unique weather and tribal practices illuminate verities about human nature and frailty that transcend time and place.

Anderson’s command of specifics in service to eternal truths was never more assured than in “Boogie Nights” and “Magnolia,” whose themes and characters can be peripherally glimpsed in “Licorice Pizza.” Gary Valentine (Cooper Hoffman), a child actor who is quickly aging out of adorability, recalls William H. Macy’s erstwhile “Quiz Kid” Donnie Smith in “Magnolia,” just as Alana Kane (Alana Haim), the aimless young woman Gary fixates upon early in the film, might be one of the bikini-clad wastrels lounging around Jack Horner’s pool in “Boogie Nights.”

“Licorice Pizza” is a decidedly sunnier version of those narratives, which centered on the darker recesses of the porn and TV industries. Here, Anderson once again turns his affectionate, somewhat pitiless lens on the entertainment world. But now it’s the wilderness of child stardom and C-list celebrity, which forms the alternately amusing and bemusing backdrop for a portrait of young love, elusive purpose, knowingness, innocence and the knockabout appeal of just hanging out.

The film begins on an exultant note, with a bravura traveling shot following Alana down a line of junior high-schoolers waiting to have their yearbook photographs taken, offering a mirror for last-minute primping. She catches the eye of 15-year-old Gary, who approaches her with an unnerving mix of puppyish adoration and glib confidence. The fact that she’s 25 has zero bearing on his resolve: He invites her to join him that evening at his regular place, the famous Valley watering hole Tail o’ the Cock.

What ensues is the kind of winsome, shaggy-dog semi-love story that Hal Ashby fashioned so beautifully with “Harold & Maude.” If “Licorice Pizza” doesn’t reach those sublime heights, it’s not for lack of sincerity. Hoffman, whose father Philip Seymour Hoffman was an Anderson rep player, does a skillful job of portraying the awkward stage between cuteness and whatever comes next: He resembles a Beach Boys-era Brian Wilson as he tries out for roles that he’s now too old or physically developed for. (The look that a casting agent, played by Maya Rudolph, gives her colleague after an audition for a Sears commercial speaks heart-crushing volumes.) In one scene, when Gary is on the phone to Alana, a gesture he makes, putting his hand to his ear, eerily re-creates a moment his father had in “Magnolia.”

Haim, the pop-rock star making her acting debut (alongside her real-life family), makes a far splashier impact as Alana, whose spiky self-doubt and sense of arrested development dovetails perfectly with Gary’s own accelerated adulthood and restless urge to reinvent. Together, they embark on entrepreneurial schemes of the era (water beds, pinball machines), all the while keeping up a touchy dance between friendship and seduction. “Will they or won’t they” animated an entire Golden Age of on-screen romance; here, that question is bracketed not just by Alana and Gary’s age difference but by ambitions that converge and diverge with hit-and-miss caprice.

At its idiosyncratic best, “Licorice Pizza” captures the in-between-ness of life, when love isn’t exactly romance, and the future turns out to be another version of the present. Anderson tells his story by way of vignettes, which gives it breezy spontaneity but also a choppy, unfinished air; the degree to which the audience will be charmed by “Licorice Pizza” depends to a large degree on how willing they are to follow a narrative filled with doglegs, digressions, perfunctory endings and self-amused set pieces.

Sean Penn and Alana Haim in “Licorice Pizza.” Melinda Sue Gordon/Metro Goldwyn Mayer Pictures Inc.

The most ambitious of those stand-alone sequences features Sean Penn, as a craggy latter-day William Holden, and Bradley Cooper, who hams it up in a bad shag haircut and gauzy hippie-chic ensemble as producer Jon Peters. Neither of their bits advances the story in any significant way; they seem intended to be funny for their own sake. Like the gas-starved cars that form a visual motif for “Licorice Pizza” (which takes place during the 1970s oil shortage), viewers’ mileage may vary.

They may also vary when it comes to some outright unfathomable choices, such as when John Michael Higgins’s character, the owner of a Japanese restaurant, speaks to his wife in an offensive fake accent, or when the actor playing Peters’s house manager flounces and minces his way through a gay caricature.

These moments, along with all the inside jokes, threaten to give “Licorice Pizza” an obnoxious air of you-had-to-be-there smugness; like the new Spider-Man and Matrix movies, this is a film of constant references, which can’t help but result in diminishing returns. “Licorice Pizza” is at its best – and is genuinely charming – when it’s simply focused on Gary and Alana, two mixed-up kids trying to make their way in a world that feels promising and perilous in equal measure. In fact, it might be most rewarding to view “Licorice Pizza” as a dream: It doesn’t always add up, or even go anywhere in particular. But it makes its own kind of offbeat, freewheeling sense.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.