I am having trouble running scripts which vary selections on different states of a PyMOL object. I've converted an MD trajectory into a pdb with 500 models that PyMOL loads as 500 states of 1 object. For example, I would then like to run the anglesbetweenhelices.py script (from PyMOL wiki) on each state separately. A simple script example:

import anglebetweenhelices as abh
cmd.load('output.pdb', object="cdp")
for i in range(1,501):
    x=abh.angle_between_helices('hel1','hel2', visualize=0, quiet=1)
    print x
In theory the select command has a state option but this doesn't seem to work (as is confirmed by http://www.mail-archive.com/pymol-users@lists.sourceforge.net/msg08224.html). I then tried using the set state command, but this also does not seem to affect the actual coordinates of the selection. The only thing that does work is if in the GUI I go to the desired state by pressing the "<" and ">" animation buttons. But is there a way to select the state from within a script?