Sorry, but the short answer is probably "You can't".
Support files are files that the question author loads into the Jobe server workspace in order to test the student's code. They don't exist in the student's environment (their browser). Conceptually at least, the Scratchpad is just a short circuit from the student's browser to the Jobe server, so the support files, which are provided by Moodle when running the job, are simply not available.
However, you can customise
the Scratchpad UI to provide just about any runtime environment you like. See the
CodeRunner UI documentation and the
demo site. Whether it's worth the effort depends on what sort of support files you're talking about and how much effort you're prepared to go to.
Here's a simple example. Suppose you ask the student a question like "Write code to open the file 'test.txt' and print its contents" and you want it to work in the scratchpad. Then you could proceed as follows:
- Create a new Python3 question.
- Click customise.
- Choose Scratchpad instead of Ace as the UI.
- Set the UI parameters to use globalextra as the wrapper source:
- Set globalextra to consist of a bit of code that writes a file text1.txt before running the student's answer code (and/or the scratchpad contents). For example:
- Create a file test1.txt containing the same as the file_contents from the above, and add that as a support file. This ensures that both the Check button and the Run button will have the file available.
- Configure the rest of the question fields, as usual. The expected output for the first test should be the file contents. And the Sample answer field might be
The Run button should now work and it should pass when Check is clicked, too.
A downside of the above - apart from the hassle of essentially defining the file twice - is that any errors in the student code will have confusing line numbers in the error message. You can avoid that by changing the wrapper to run the student code in a subprocess after setting up the file(s).
If the above doesn't fit with your use case, feel free to post back, explaining what sort of question you're trying to ask.