yeah that's true I've now made the expression source the script before it tries to run it which again in the viewport is fine but it doesnt like it in the batch render.