This is really unintuitive but import
already returns the return value of the imported script, but-but import
s only work at the beginning of a line, but-but-but, since Lua doesn't really care about whitespace, you can write it like this:
local __ =
import 'underscore'
__.each({1, 2, 3}, print)
__({1, 2, 3}):each(print)
Both examples now work as expected with an unmodified underscore.lua using this method.