import os
import maya.cmds as cmds
class mypars_ts:
    def __init__(self):
        print "Hello\n"
    def testing(*args):
        print "Call Came\n"
    def window_lod (self):
        if cmds.window('ExampleWindow', exists=True):
            cmds.deleteUI('ExampleWindow', window=True)
        cmds.window( 'ExampleWindow' )
        cmds.columnLayout()
        cmds.text( label='Size and position the window before closing it.' )
        cmds.button( label='Close', command='testing' )
        cmds.showWindow( 'ExampleWindow' )
my_calls=mypars_ts()
my_calls.window_lod()

when ever i am trying to execute this code .. i am getting a error

# Error: name 'testing' is not defined
# Traceback (most recent call last):
#   File "<maya console>", line 1, in ?
# NameError: name 'testing' is not defined # 

but thts already defined

def testing(*args):
        print "Call Came\n"

where i am wrong :( can any one help please :(

Edited 3 Years Ago by mike_2000_17: Fixed formatting

import os
import maya.cmds as cmds
class mypars_ts:
	def __init__(self):
		print "Hello\n"
	[B]def testing(self,*args):[/B]
		print "Call Came\n"
	def window_lod (self):
		if cmds.window('ExampleWindow', exists=True):
			cmds.deleteUI('ExampleWindow', window=True)
		cmds.window( 'ExampleWindow' )
		cmds.columnLayout()
		cmds.text( label='Size and position the window before closing it.' )
		cmds.button( label='Close', command=testing)
		cmds.showWindow( 'ExampleWindow' )
my_calls=mypars_ts()
my_calls.window_lod()

changed but no way its not working :(

fixed ....

import os
import re
import maya.cmds as cmds
class mypars_ts:
    def __init__(self):
        print "Hello\n"
#here self added
    def testing(self,*args):
        print "Call Came\n"
    def window_lod (self):
        if cmds.window('ExampleWindow', exists=True):
            cmds.deleteUI('ExampleWindow', window=True)
        cmds.window( 'ExampleWindow' )
        cmds.columnLayout()
        cmds.text( label='Size and position the window before closing it.' )
#here also
        cmds.button( label='Close', command=self.testing)
        cmds.showWindow( 'ExampleWindow' )
my_calls=mypars_ts()
my_calls.window_lod()
This article has been dead for over six months. Start a new discussion instead.