To access local variables you would either need to pass it directly into test() as a parameter or pass vars() into test() as a parameter. Essentially you need to use parameters, thats the only convenient method outside of actually finding the variable in memory and getting the value from there which is just annoying.
tl;dr use parameters