Thomas Rhett is one of several country artists who landed a song in the new film, 'The Best of Me,' based on the Nicholas Sparks novel of the same name. But although Rhett's tune was a perfect fit for the romantic flick, he reveals it was actually written long before the film opportunity.

"I wrote this song called 'The Way Things Go' a few years ago, and over the past year I've gotten to be really good friends with the guy that scores a lot of Nicholas Sparks movies," he told The Boot at the film's Nashville premiere. "So he had asked me to write a song for the soundtrack, and I pitched him a couple of the ones I had already written, and I guess he fell in love with the song. But it's really cool -- this is the first time I've ever had a song in a movie."

The 24-year-old isn't afraid to admit he has actually been a fan of Sparks for several years.

"I've been married for two years, and I think anybody that's ever dated anybody has seen 'The Notebook' before," he notes. "So obviously I'm sure that's where a lot of people's love for Nicholas Sparks started, and I'm a sucker for a good love story, and a good love song. I'm a big fan. I actually read the book for this movie, which is kinda crazy. So to have my first song in the movie of a book that I read is pretty awesome."

Other artists who have songs in the movie include Hunter Hayes, Kip Moore, Kacey Musgraves, the Eli Young Band and Lady Antebellum, who have two songs on the soundtrack -- and helped the author decide to use mostly country artists on the soundtrack.

“That became the intent after Lady Antebellum signed on,” Sparks explains to Taste of Country. “I was just a fan of Lady Antebellum. Their name was mentioned before anyone was cast, before we had a director. We sent them a synopsis, and they ended up writing this amazing song. This song, ‘I Did With You,’ inspired the theme for the entire soundtrack. I think it’s the best soundtrack we’ve done, and it’s very heavy on country, which is why we’re here in Nashville.”

'The Best of Me' opened in theaters nationwide on Oct. 17. Download the soundtrack here.