Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Functions in an executed script ( execfile() )
  RSS 2.0 ATOM  

Functions in an executed script ( execfile() )
Rate this thread
 
31553
 
Permlink of this thread  
avatar
  • Total Posts: 11
  • Joined: 05 June 2009 09:03 AM

Hi all,

I’m running scripts with the execfile() function, via this “MainScript” I posted here (3rd post):
http://area.autodesk.com/for...parsing-a-windows-folder/

Though the scripts work well alone (when I import and run them independently), I’m facing a problem when these scripts are “executed” via my MainScript:

All the functions in these scripts seem not to be aware of all variables declared outside of them.

As these functions are called via a Tool ( Button.OnClick.Add(MyFunction) ), I can’t give them variables ( like : MyFunction(X,Y,Z) ).
So these functions can’t call other function too.

Don’t hesitate to ask for more details.
Thx



Replies: 0
avatar

This seems to be a limitation of the way you have set your scripts unfortunately, since this limitation exists maybe using less seperate scripts, and global variables…

My computer prof. would hate me for even typing these words, but with the way callbacks work in MotionBuilder since you can’t pass paramater correctly, you need to change it up a little bit.

~Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0
avatar
  • hansen.ck
  • Posted: 15 September 2009 07:17 AM

You could try to use the lambda command.  It is in the standard python documents, and it will let you pass in variables and such.



Replies: 0