LOS ANGELES — When Cole Sprouse left Hollywood, he didn’t think he’d ever come back. He was 18, and he’d been acting alongside his identical twin brother since they were in diapers. The choice to work as a kid had not been his own: His single mother wanted to be around for the boys and have a steady career, and putting her twins in the entertainment industry seemed like a “lucrative alternative,” he says now.

But then Sprouse and his brother, Dylan, landed their own Disney Channel show, “The Suite Life of Zack & Cody.” By 13 they’d signed a licensing agreement with Dualstar Entertainment Group, Mary-Kate and Ashley Olsen’s company, to develop their own quarterly lifestyle magazine, ringtones and cologne. They were full-blown teen heartthrobs.

And yet when it came time to apply for college, the twins decided – unlike fellow Disney stars Miley Cyrus, Selena Gomez or the Jonas Brothers – that they wanted to pursue higher education and enrolled at NYU.

“My brother and I were getting recognized a lot. It became one of those things that we realized we had just sort of taken as gospel since we were little kids, and that there was another path through life,” Sprouse, now 26, recalls. “I was completely content, at the time, to let the Disney shows exist within this little nostalgic bubble and I was ready to move on.”

But somehow here he is now, sitting on the balcony of a ritzy hotel smoking Marlboros, promoting his first leading role in a movie, “Five Feet Apart.” And the film, a romantic drama about two young lovers with cystic fibrosis, is not the only project he’s taken on since graduating with honors from NYU in 2015. For the past two years he’s starred as Jughead on the CW series “Riverdale,” a teen drama based on the Archie comics.

The program, which has already been renewed for a fourth season, has reignited Sprouse’s popularity. On Instagram, he has nearly 24 million followers, many of whom are obsessed with tracking his real-life relationship with his on-screen love interest, Lili Reinhart.

“Riverdale” also rekindled Sprouse’s love for acting. During college he did none of it, opting to study something completely different: archaeology, geographic information systems and satellite imaging. He became interested in the field because his grandfather was a geologist and “it seemed like an academic discipline that was really competitive and challenging. I fancied testing if I could do something like that.”

Dylan Sprouse, left, and Cole Sprouse arrive at the Los Angeles premiere of “Five Feet Apart.” Photo by Jordan Strauss/Invision/AP

He traveled to Germany, France and Bulgaria for excavations, and on one dig, after spending six weeks hunched over a 1-by-1-foot trench of dirt with a toothpick, he pulled a 35,000-year-old Aurignacian stone blade out of the ground. Following graduation, he began working in cultural resource management as an archaeological assistant in a Brooklyn artifact laboratory. He was thinking about going into academia: studying at graduate school, researching a specific time period or peoples and becoming a professor.

But then he heard from his acting manager, who, per Sprouse’s request, had left him alone during his four years at NYU.

“He asked me to come back for a single pilot season. I was on this path, but I said ‘OK, if I don’t book anything, I don’t think I want to do acting anymore,’ ” he says. He did book something – “Riverdale” – and soon began to realize it wasn’t acting itself he had an issue with.

“From a very young age, the industry had been defined as a business,” he continues, “and it took me going away to school for a while and redefining that to find (performing) as a passion again.”

On “Riverdale,” Sprouse’s Jughead is a something of an outsider – an artsy writer with a signature beanie and leather jacket. Roberto Aguirre-Sacasa, the show’s creator, initially thought the actor might be a better fit for Archie, the lovable jock. But after reading the pilot script, Sprouse expressed interest in Jughead – even though the character only had one scene in the episode.

“It was already kind of a sign that he viewed himself differently,” says the showrunner. “I think Cole is an old soul. He’s done a lot, and he’s seen a lot, and I think that gives him a little bit of wisdom that other actors his age might not have. When he smiles, he looks like a true 15-year-old kid. But when he furrows his brow, he looks like he has the weight of the world on his shoulders.”

When it came to tackling his first adult movie part – he and his brother were in Adam Sandler’s “Big Daddy” as boys – Sprouse didn’t want to stray too far outside of his comfort zone. Recognizing the persona he’d established on “Riverdale,” he chose to play a similar archetype in “Five Feet Apart”: Will, a brooding teenager whose rebellious spirit attracts his romantic interest, played by Haley Lu Richardson of “Split” and “Support the Girls.”

“This role was interesting in a larger business sense, because a return to film also meant a question of how much of (the ‘Riverdale’) audience would turn out,” says Sprouse. “I didn’t want it to feel so incredibly distinct.”

The CBS Films production, out Friday, follows two CF patients as they fall in love but are unable to physically touch due to risk of cross infection. Cystic fibrosis is a genetic, progressive disease that affects lung function, making it difficult to breathe; the average life expectancy for the 30,000 afflicted in the U.S. is 37.5 years.

Justin Baldoni, who makes his directorial debut on “Five Feet Apart,” is also an actor on a CW series: “Jane the Virgin.” But he and Sprouse never crossed paths at network affairs. Instead, Baldoni began thinking of him for the role after catching some of his interviews on morning talk shows.

“Cole’s a great actor, but I was actually more interested in who he was off-screen,” explains Baldoni. “Cole had to grow up a lot faster than the normal kid. He was surrounded by adults: directors and producers and writers and people that were basically employing him. … When you grow up with cystic fibrosis, you grow up with doctors and nurses. Those are your friends. You learn medical terminology. You have to understand regimens and taking care of yourself in a way that regular kids don’t. You’re forced to grow up a lot faster. So there was an interesting parallel between Cole’s life and Will’s life.”

Baldoni came to “Five Feet Apart” having steeped himself in the world of CF. He had the idea for the film while working on a web series about those with terminal illnesses, “My Last Days.” One of the episodes focused on an 18-year-old girl named Claire Wineland, a CF patient whom Baldoni became so close to that he ultimately hired her to serve as a consultant on “Five Feet Apart.”

Sprouse spent a lot of time with Wineland, who died last September three months after filming was completed, talking about how CF affects both the mind and the body, including how the disease makes it difficult to gain or maintain weight. Together, he says, they came to the conclusion that it would be “a really powerful choice to embody that physicality,” and so with the aid of a nutritionist, Sprouse lost 25 pounds over the course of five weeks.

Sprouse initially told Baldoni he was somewhat hesitant to sign onto “Five Feet Apart” because he knows the scrutiny that films in this genre – “The Fault in Our Stars,” “A Walk to Remember,” “Me Before You” – can face for romanticizing illness.

“But I’m a believer that even if it might feel like the volume is a little bit too high within that genre, it still serves as an amazing platform to discuss something like cystic fibrosis,” says Sprouse. “And the star-crossed lover narrative – this is something that has existed before Shakespeare to Ovid and Pyramus and Thisbe. It’s part of our cultural memory bank. It’s one of those motifs that we just understand so well.”

As for his future as an actor, Sprouse says he doesn’t expect to leave Hollywood again any time soon.

“It’s easy to forget, because this industry has so many different sides to it, that the act of acting is an incredibly enjoyable thing,” he says. “It’s a really empowering thing to do and it’s all the stuff on the outside of it – the publicity and the celebrity – which I actually had a problem with.”