Personally I'd say something like "the full source code for the script discussed in this tutorial can be found in Appendix A" near the start, and give the full source code within the pod. Then during the tutorial, when you need to refer to particular sections of the source code, instead of just saying a line number, quote a few lines of code — the part under discussion and any extra lines necessary to understand it in context. If this is more than four lines, perhaps add some comments like ##line 18 so that readers can find their way around it.
You may also want to include the full script as a standalone file outside of the pod, but don't rely on this as the only way to provide it, as examples aren't typically installed.