accessing render pipeline B2.58

hallo together,

at the moment i am trying to access the render pipeline in 2 different ways.
i have some questions and problems with that.

1: i try to atach a script wich got executed before every rendered frame via:

this is not working verry good. i get the following error: TypeError: ‘NoneType’ object is not callable. any ideas what is going wrong there?

2: i try to get the last rendered image to perform some image manipulations with PIL.
how can i access the last rendered image?

maybe you guys have some ideas. thanks.