Thanks Jean for the quick fix.
I'm glad that the problem wasn't with my code, it always takes a lot of time to implement your own ideas, but after 2 years of learning and practicing I can now say that it was time well spent.
My tip to other users - I had no idea about coding before, I had to learn everything from scratch, but the help in PD is very good and I would like to thank Jean and Ed for their good advice.
Give it a try, it's a bit frustrating at the beginning, but in the end you have the possibility to realize your ideas by yourself and which other astro-software allows that.