You have to explicitly declare your function a closure by adding
closure after the function arguments.
function Hi() let a = "hi" function s:inside() closure echo a endfunction call s:inside() endfunction
:call Hi() will print out an error.
s:inside to make the function script local, rather than global.