Maya Python: name not defined with floatSliderGrp
<p>I'm trying to get a scale slider steup, and whenever I change the slider value, I'd like for the new value to be printed out:</p>

<pre><code>    scaleSlider = cmds.floatSliderGrp(label='Curve Scale', 
                                  field=True, 
                                  minValue=0.0, 
                                  maxValue=2.0, 
                                  fieldMinValue=0.0, 
                                  fieldMaxValue=2.0, 
                                  value=1, 
                                  cc="print cmds.floatSliderGrp(scaleSlider, q=True, v=True)" )
</code></pre>

<p>This seems pretty simple, but I'm getting this error:</p>

<pre><code>// Error: name 'scaleSlider' is not defined
# Traceback (most recent call last):
#   File "&lt;maya console&gt;", line 1, in &lt;module&gt;
# NameError: name 'scaleSlider' is not defined //
</code></pre>

<p>The error is not very descriptive, unfortunately. I'm having trouble tracking down what the issue might be. At first I thought it was self-referential, but the error would tell me if so, correct?</p>

<p>work with dict and lambda, </p>

<pre><code>def get_ui_value(ui_id, ui_type):
    mcds = globals()["cmds"]
    method = getattr(mcds, ui_type)
    print method(ui_id, q=True, v=True)

ui_dict = {}
ui_dict["flt_slider_xy"] = cmds.floatSliderGrp(label='Curve Scale', 
                              field=True, 
                              minValue=0.0, 
                              maxValue=2.0, 
                              fieldMinValue=0.0, 
                              fieldMaxValue=2.0, 
                              value=1)
ui_dict["int_slider_xy"] = cmds.intSliderGrp(label='Curve Scale', 
                              field=True, 
                              minValue=0, 
                              maxValue=10, 
                              fieldMinValue=0, 
                              fieldMaxValue=2, 
                              value=1)
cmds.floatSliderGrp(ui_dict["flt_slider_xy"], e=True, cc= (lambda message:get_ui_value(ui_dict[flt_slider_xy], "floatSliderGrp")))
cmds.floatSliderGrp(ui_dict["int_slider_xy"], e=True, cc= (lambda message:get_ui_value(ui_dict[int_slider_xy], "intSliderGrp")))
</code></pre>

python user-interface maya