There's one problem, though - changing a global variable in one instance changes it for all others of the same script. That makes it hard for each instance to have its own state variables (I'm not even sure how it would be done). In case I'm not making sense (it's very late ;) take a look at the attached patch and script.
Yes, a script is shared among all objects executing the same script. This is because there is only one instance of the Python interpreter and the script is loaded as a module (once). So, if you want to have different instances, you have to use different scripts.
With pyext (the real Python external) the situation will be a bit clearer.
Also, a minor bug: if a py object hasn't been given a function name yet and you send something to its right inlet, pd crashes.
Thanks, i'll fix that.
greetings, Thomas