If your record contract is still valid with a record company you are signed with, you shouldn’t record or perform any music for a film production (or a motion picture) without getting clearance from your record label to do so.
The main reason is that normally a record contract will state that the record company will have all sound recording copyrights from you as an artist assigned to them for any music released in the duration of your record contract.
So even if you get a chance as an artist to make music for a song to be used in a film production as a soundtrack. Your record label has the legal right to green-light that deal or not.
And in most cases you as an artist will usually be paid through a work-for-hire agreement meaning the movie studio will give you a lump sum for the soundtrack. The same applies to how the record label will also be paid by the movie studio.
The reason movie studios prefer the work-for-hire agreement is because that way they can keep all the music copyrights associated with that soundtrack without having to run into music licensing issues in the near future after the movie has been released.
In other words the movie studio will be paying for ownership in terms of both the sound recording copyright from the record label and music publishing copyright from you the artist as you proceed to record a soundtrack for the film.