Think about why nobody but you is inconvenienced by this. I am sorry, this is a you problem, because you are violating common idioms of the language.
There is basically never a reason not to pass your data structure to a function, which is why what you are doing is an incredibly niche functionality.
Also functions should be particular to data structure. That is why types exists.