I think what you want to do is have the function part of the code in the file and send the arguments via AppleScript as a list (Array), which is pretty easy to do:
The contents of the jsx file could be:
testFunc(arguments);
function testFunc(t) {
alert('argument one: ' + t[0] + '\r' + 'argument two: ' + t[1]);
}
and the AppleScript could be:
tell application id "com.adobe.Photoshop"
activate
do javascript PathtoJSX with arguments {"foo", "bar"}
--I tested using:-- do javascript (choose file) with arguments {"foo", "bar")
end tell
Whatever you use for the JS code (text or file), you just make sure you use the arguments array reference in that code. Note that if you test this (as I did) by using a text variable instead of an alias (file reference), the return character would need a double escape.