Back in her Disney Channel days, Bella Thorne performed several songs for her series “Shake It Up,” and, in 2014, she put out a splashy music video for a bubblegum-pop solo effort. But, when the 20-year-old signed on for her new music-infused movie “Midnight Sun,” she admitted to her director that she didn’t actually “love” singing.

“We really kind of dragged her into the recording studio,” director Scott Speer tells The Post. “And then she just unleashed [the character], and it was perfect and everything that I was looking for.”

In theaters Friday, “Midnight Sun” stars Thorne as a teenager who can’t go out in the daytime because of her rare (and real) genetic disease called Xeroderma Pigmentosum, which makes ultraviolet rays lethal. Her life becomes more complicated when she falls for a boy (Patrick Schwarzenegger) and hides the disease from him despite their growing relationship.

Thorne’s character is also a musician, with her acoustic pop songs playing a large role in the film. Thorne recorded five songs for the movie and its soundtrack, including lead single “Burn so Bright.”

Speer — who is a former music-video director for artists such as Blake Shelton, Jason Derulo, Paris Hilton and his ex-girlfriend Ashley Tisdale — fielded submissions from various songwriters with his producers and music supervisor Zach Sinick. But, he says Thorne became an integral part of the decision-making team once recording began.

“I took her feedback very seriously in terms of, [if] it feels right to her, chances are it’s touching something that is very real to the character,” he says.

The process had a big effect on Thorne. Speer says she’s credited the movie for inspiring a return to her own music. She’s reportedly working on an album. And she recently performed “Bitch, I’m Bella Thorne,” a rap single reminiscent of Kesha’s early work, to a crowd that included Justin Bieber, during the “Midnight Sun” premiere after-party at Los Angeles club Avenue.

On Instagram, she’s said that a self-directed music video for the song is coming soon.

“I think that ‘Midnight Sun’ got her back in touch with singing and recording,” says Speer. “And she thought to herself, ‘This is a tool. This is an avenue for my vision and my voice.’”