IK EXACTLY WHAT YOU'RE TALKING ABOUT THIS HAPPENS TO ME ALL THE TIME IF I STAY IN ONE SPOT TO LONG, AND I PHYSICALLY CANNOT MOVE THAT LIMB!! And no, it's not just "asleep!"
Usually, just hold onto something stable like your bed or a counter to slowly help you flex and get your leg working again. You'll probably have limp or walk strangely for a couple minutes, but just trying to move it usually does the trick after awhile!
I'm not exactly sure what it is that causes this, but Ik in my case it could be neurological or circulation issues. Perhaps bring it up to a doctor at your next visit!
Best of luck!! <3