Stuck in TM after using tesseract

Sooo, i was backtracking to get tm’s or other items or mega stones i missed…
Found a tesseract spot, used tesseract, and ran onto it by accident, just as the item reappered.
so now im stuck on a TM.

You can get out if you have a pokemon that can learn fly, if you do, you can try this.
If not, then you’ll have to get back to the last savepoint, and hope that you don’t have autosave on.

if all else fails u can use the dexnav trainers to faint all ur pkmn and transport u to the nearest pkmn center

The same thing actually happened to me, but it was on the top of the Jade tower. The Dexnav Didn’t work, and I couldn’t use fly from my mew, or an escape rope. This just sucks.