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…
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…
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:…
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…
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…