function declated at global level not found

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2012   #1
Unhappy function declated at global level not found

I have two problems i couldnt figure out why is it happening..

I have function ImgplaneDone() declared at global level

but when I try to call the function from within the class like this

self.donebtn=cmds.button(label="Done", command='ImgplaneDone(pathdict)',align='right')

Even though the ImgplaneDone() is at the same level as main() function is (not inside main function)
I get error
 # NameError: name 'ImgplaneDone' is not defined #
, the weirdest thing is i only get error if I run the script like this

import setimgpln
setimgpln.main()


but if i load it in the script editor and press ctrl + enter then evrything works fine.,...

the second problem I couldnt understand why is it happening I have created an instance of the class that contains GUI framework and call the function create from main() function,

Now even though I have this code at the end
if __name__ == '__main__':
  	main() 


i still have to make a call like setimgpln.main() from shelf button or command line at bottom instead of just setimgpln.

Last edited by DEVILSAN : 09 September 2012 at 04:35 AM.
 
Old 09 September 2012   #2
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:58 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.