If there is still interest... The subroutine shown will take a Python Script as an argument, run it, then return the results. As noted in the comment, putting this in a subroutine means that it doesn't have access to local variables in the calling routine. But import os
in the Python code gets you access to KMVAR_everything_in_scope.
4 Likes