I’ve heard of people making a way to attach the key inside their motorcycle boot. Inside a special coat pocket is a good idea, too.
If I told you where my spare key is hidden, then it wouldn’t be a secret place anymore.
Making a dedicated key for the frunk can help this situation, too. See this thread: Creating a dedicated key for the storage compartment. At least it makes it more difficult to accidentally lock your main key inside the frunk. It also means your spare could be inside the frunk or under the passenger seat. You would need to loose both the main key and the frunk key to not have access to the spare.
I made 4 spares 2 for the frunk and 2 that work the ignition (and the frunk of course)
I put an ignition key in the paperwork compartment at the very bottom of the frunk, I zip tied a key that opens the frunk near the back side of the headlight kind if by the turn signal (it's zip tied to the metal tubing) I also carry a spare for the frunk in my wallet and left the remaining spare ignition key at home in a safe.
I can use my frunk key from my wallet to open the trunk and get access to the ignition key, if if list my wallet and keys (unlikely but possible) I can snap the zip tied key lose using only the key for leverage, it's hidden away out of sight and the zip tie hasn't become brittle due to heat or sunlight, it's been there 2 or 3 years now
I got my spare keys at ace hardware for a dollar and change each
I've been holding off making a dedicated frunk key because I haven't a good handle to mount the key, just last week I found the cap to nail polish remover is the perfect diameter to blend well enough to look OEM