Thanks for the tip, John. I'll start writing more modules then.
On Tue, Aug 10, 2010 at 11:28 AM, John Creson <[email protected]> wrote: > from myModule import * > > does what you are worried about, and if called within Maya might > present a name clash situation. > You don't want to do this with maya.cmds because maya's file cmd would > overwrite Python's. > If called within another module, just brings in those functions into > that module's namespace directly. > > On Tue, Aug 10, 2010 at 11:26 AM, John Creson <[email protected]> wrote: >> If you are using a module (offline .py script file that you import >> into your python, in maya or in another module) >> Then you are in the namespace of that module. >> >> So >> >> import myModule as mm >> >> then >> >> mm.myFunc() >> >> is in the mm namespace >> >> import myModule >> >> myModule.myFunc() >> >> is in the myModule namespace. >> >> On Tue, Aug 10, 2010 at 10:35 AM, Alan Fregtman <[email protected]> >> wrote: >>> Hey guys, >>> >>> Coming from Softimage I'm a little confused by Maya's way of handling >>> function declarations in scripts. In Soft, they're always local unless >>> declared global using some SDK/API stuff. >>> >>> It would appear that in Maya in any Python script (or MEL for that >>> matter) a function declaration stays in memory and is accessible >>> globally. >>> >>> I'm worried about overriding other people's or Maya's own functions if >>> I don't give it very unique names. Is there some way to declare >>> functions for local use by the main global function in the same >>> script? Am I making sense? >>> >>> Cheers, >>> >>> -- Alan >>> >>> -- >>> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya -- http://groups.google.com/group/python_inside_maya
