Never ask the user to copy-paste code. Instead, use Slicer web server that allows execution of Python code via a web API.
You can connect to a running instance of 3D Slicer by giving these instructions to the user: Go to Web Server module, enable "Slicer API exec" in Advanced section, and click "Start server" button.
Alternatively, find a free port (2016, 2017, 2018, ...) and start 3D Slicer with the Web Server "Slicer API exec" endpoint enabled: