Does someone know how to import multi sub directories with *.py and *.pyw files with python? For exemple to import my mel script lib I am using the following mel script code : // ================== global proc LoadLib (string $libsToLoad[]) { string $dir = `internalVar -userScriptDir` + "_SAMA_LIB/MEL/"; for ($lib in…
I can show you an example of how I've structured it. From what I know the first __init__ needs to be in your pythonpath. So it looks a like this:python(This directory is provided in the python path) -userSetup.py -myCode -code -myCode.py -__init__.py(empty init) -__init__.py(* This does have a line) * import code.myCode as…
At work now, let me see if I can get something working with your directory structure Okay so I've made a file structure similar to what you have, just put the content into your scripts folder: http://www.digitalartisan.ca/python__init.zip now run: import __SAMA_LIB.PY.OpenGL as OpenGL as your initial import, then:…
I tried these different combination once I did a clean"import" : from _SAMA_LIB.PY reload(LoadLib) as testtest.LoadLib("OpenGL")# Error: ('invalid syntax', ('<maya console>', 2, 24, 'from _SAMA_LIB.PY reload(LoadLib) as testn'))# File "<maya console>", line 1# from _SAMA_LIB.PY reload(LoadLib) as test# ^# SyntaxError:…
Can you tell me what directory structure you're using? Are you using something similar to what I have shown? I don't include the .py in my imports. And once you do a clean import you only need to run: reload(test). Diffult to know what exactly is going on when I don't know your exact module structure. I've never run a from…
you only imort the first time. In my example above if I made any changes to the module after the import I would use reload() so: reload(testCode) so try: reload(test) So just to be clear, you import your module the first time and only the first time, then everytime you make a change you use reload. Not at work so can't…
alright it works now with : from _SAMA_LIB.PY.OpenGL import SAMA_ExportToOpenGL as testtest.SAMA_ExportToOpenGL() Thank you a lot! I am updating my script now but I have a set of error,conflict, problem etc... and I cannot launch several time the same following command from Maya... I Need to restart maya for each test :…
Just tried this in my Maya scripts folder myCode -__init__.py(*) -code -testCode.py -__init__.py (*)In the init put this line: import code.testCode as testCode So to call a function within the testCode.py you can go import myCode myCode.testCode.myFunc() Or within Maya you can go: from myCode import testCode as tc…
Ok let's choose the following one: -|scripts (Maya defaul scripts directory) ---|_SAMA_LIB|PY|OpenGL|SAMA_ExportToOpenGL.py Maybe easier like this> "C:\Users\sama\Documents\maya\2009-x64\scripts\_SAMA_LIB\PY\OpenGL" The right command to import the SAMA_ExportToOpenGL.py file with his function is : from _SAMA_LIB.PY.OpenGL…