Python script to Rhino button

Is it in a directory which is listed when you execute this on a button?

import sys
print sys.path

I also have a problem with placing this script on a button:

import rhinoscriptsyntax as rs
import random

def test():

Ids = rs.GetObjects("Select block instances to rotate", filter = 4096, preselect=True)
if Ids is None: return
vec = rs.VectorCreate([0,0,1], [0,0,0])


for Id in Ids:
    pt = rs.BlockInstanceInsertPoint(Id)
    ang = random.randrange(-180, 180)
    rs.RotateObject(Id, pt,ang,vec)

if name == “main”:
test()

I placed it between

! _-RunPythonScript (

)

as it was suggested, however, it does not work (It just runs trough without giving me the opportunity to select anything…)… I runs fine in the editor tough…
any clues?
Thanks

Andreas

Hi Andreas - the solution is buried above -

Also, when using that ‘name’ and ‘main’ it is '__name__' and '__main__'

-Pascal