Your OnLoad function was global so it can be called pretty much anywhere. The only proviso being that the file containing the function has to be loaded before the function is used (same goes for within in the same .lua file, a function (variable etc.) must be defined before it is used.)
Lua Code:
MyFunction() -- error
function MyFunction()
print("This is MY function!")
end
Lua Code:
function MyFunction()
print("This is MY function!")
end
MyFunction() -- no error