Is there any way to convert string to module name in order to import it
ex:
characterName = mc.textField(character_name, q=1, text=True)
char_project_folder = mc.textField(project_folder, q=1, text=True)
rig_python_path =
r"{0}\{1}\scripts\python\{2}Rig".format(char_project_folder, characterName,
characterName)
rig_mod = importlib.import_module("{0}Rig".format(characterName))
from rig_mod import rig
Error: ImportError: file No module named rig_mod #
as you can see it doesn't recognize the module as it deals with it as a
string
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/5fbb91c7-1c54-458b-8115-f932a6397404n%40googlegroups.com.