Change Background per Script

I've got yet another problem. I want to write a script that changes my background each time a given timespan runs out.I use gsetting to change it. Strange thing is, outside of the script it works fine with...