Python Value list input value read

Hi All,

Is there a way to read value list inputs “highlighted in yellow” instead of outputs once plugged in into python script?



The following code will do it as long as it is on the first input and it is the first source.
Change the index values depending on it.

import rhinoscriptsyntax as rs
import Grasshopper as gh

ghdoc = ghenv.Component.OnPingDocument()
valuelist = ghenv.Component.Params.Input[0].Sources[0]
for x in valuelist.ListItems:
    print x.Name