I’m currently trying to wrap my head around an issue I’m having.
I like they way one can organize scripts and modules for different Maya Versions with the MAYA_MODULE_PATH and .mod files.
Thats why i also have some custom scripts stored and loaded this way
the .mod file for my python scripts reads as followed:
+ MAYAVERSION:2018 PLATFORM:win64 mrdebug 1.0 …/modules/mrdebug
+ MAYAVERSION:2017 PLATFORM:win64 mrdebug 1.0 …/modules/mrdebug
the path that is appended to sys.path this way is:
there i have my script sitting called. mrdebug.py
so in maya i can easily import this with
now my problem starts.
thats the code thats in mrdebug.py:
import maya.cmds as mc if (mc.window(windowID, q=True, exists=True)): mc.deleteUI(windowID) windowID = "mrdebug" window = mc.window(windowID, title="mrdebug", rtf=True) windowLayout = mc.columnLayout() mc.setParent(windowLayout) mc.button(l="method_a", w=300, c="method_a") mc.button(l="do_something", w=300, c="do_something") mc.showWindow(windowID) def method_a(): print("this is method A") def do_something(): print("doing something")
Now what this does, is that while drawing the UI works fine and all, the method call results in an error because the method would need to be called with mrdebug.method_a() instead of just method_a().
I guess using:
from mrdebug import *
would do the trick, but i find it hard to believe thats the right way to handle this situation.
Can some experienced coder point me to a clean and professional solution for this problem?
I appreciate any help.