On Feb 8, 12:38 am, Ofer Koren <
kor...@gmail.com> wrote:
> When you call the 'python' mel-command, you're essentially running that
> python code in the "__main__" module (the script editor window). This means
> that only variables/functions defined in that __main__ module will be
> available to the python call, and definitions made in the module where the
> python call is made will not.
> So you'll have to refer to your module where your definitions exist in order
> to use them. You can do this generically like so:
>
> cmd = "import %s; mayaString=%s.customClass(); mayaString.doit()" %
> (__name__, __name__)
> mm.eval('python("%s")' % cmd)
>
> (beware of sys.path.append(...) as it will keep adding to your python path
> in each cmd call and slow down your python import mechanism; use it only if
> needed - i assume that since the module is actually running it is already
> imported and so it probably already exists in the python path)
>
> -
Oferwww.mrbroken.com
>