Save and restore namespace

Make a copy of the scripts, then try and remove all the parts of it that are not essential to this issue. Keep just the minimal parts that produce the same error when you run it, and post that code.

There’s more tips about providing useful info while asking questions, in this thread: “make it easier to help you”.