the paths in mod work like this: $CONTENT_MODUUID/Scripts/test.lua
you cannot use $CONTENT_DATA
so the best solution would be to declare a variable with the UUID of the mod in your mod and access the files like this:
local selfuuid = "dcf0ddb5-5585-4e10-8302-7dc58b2aba50"
better.loadfile("$CONTENT_" .. selfuuid .. "/Scripts/test.lua", nil, _G)
if you start the path with "/" then you will be accessing the isolated betterAPI filesystem.
the better API filesystem allows you to save any files in any format, delete them, rename them, and do WHATEVER you want with them.
however, you cannot execute files (so the filesystem remains secure).
the betterAPI filesystem is restricted in the AppData\Roaming\Axolot Games\Scrap Mechanic\User\User_steamid\BetterFS directory.
all files in this filesystem are available to any mods using betterAPI and the user.
please note that when using "better.filesystem" only the paths in the betterAPI filesystem are available to you
(that is, the paths of $CONTENT_UUID are not available) this is done to prevent overwriting scripts of other mods
(readFile/exists/isDirectory/list exceptions, they can use the paths $CONTENT_UUID).