SB supports namespaces using the MODULE / END MODULE statements. All variables, function and subs are localized to the module and the :: syntax must be use to access the modules resources from your main:: program (or other modules) namespace.
bar = 1
MODULE foo
PRINT bar,"\n"
bar = 2
FUNCTION modfunc
LOCAL bar
bar = 3
modfunc = bar
END FUNCTION
END MODULE
PRINT bar, "\n"
PRINT foo::bar, "\n"
PRINT foo::modfunc(), "\n"
C:\scriptbasic\test>module
undef
1
2
3
C:\scriptbasic\test>