Indeed, passing arguments to the loaded chunk was the simpler solution, but Tomas answer made me reconsider the problem and I think that I can simplify it enough so I don't need to use string templates to build the code.
I think that I was making things harder than they need to be.
Anyway, I think I'll hit some cases were I'd need to use templates, so the varargs suggestion will definitely be used.
Thanks everyone for your help.