An interesting situation
Nothing interesting, just need to figure out how to work
the scope.
LoadThemePart inside a method you declare a new variable $some_var, its scope is limited by this method, i.e., outside this method, it is impossible to access.
Then you plug in a new php file. Because it is connected within the scope of the method loadThemePart, he has access to the local variable named $some_var.
In the old function you are trying to access a global variable $some_var, but it's not declared anywhere in the code, there are local $some_var. Consequently, the global $some_var is null or empty.