Thank you for your patience, I'm not a great coder but I would try to do my best simplifying all my rigging stuff.
I searched everywhere on the net, if I'm asking right now it's because I clearly can't understand somewhat.
I'm creating an auto-rigger tool and I'm declaring some curves in main.py.
Actually I created a particular curve with more than seventy CVs and so, in main.py, I have this thing long about twenty rows. Navigate what I wrote is becoming awful.
So, for now, I want to have a better order moving this object in another module called UI_library.py.
In UI_library.py I declared some function to access my clavController object.
.../UI_library.py
def createClav():
clavController = cmds.curve(d=1, p=[coordinates])
In main.py I call the func.
.../main.py
import UI_library as libs
clavController = libs.createClav()
The newClav curve is generated in my Maya scene and when I execute
print(newClav)
The result is none and at this point I'm stuck because I can't use the curve I built
Should I create global var between files? Learn and use classes? I thought this would be a simple work of "translation".
Thank you again
question from:
https://stackoverflow.com/questions/65849750/read-and-manipulate-objects-from-another-module-python-maya 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…