if True:
module_name_variable = "usermodules.todd"
else:
module_name_variable = "usermodules.jane"
module = __import__(module_name_variable)
instance = module.Klass()
result = instance.prebuild()
# Should have the same effect as:
import usermodules.todd
instance = usermodules.todd.Klass()
result = instance.prebuild()
I think you're correct to be wary of calling Python's eval:
http://docs.python.org/2/library/functions.html#eval
On 21/05/13 20:54, Todd Widup wrote:
is there a python equivalent to eval?
I am setting up a few things that could allow the user to specify a
pre-build function but user A could specify a different prebuild
function than user B, and I need some way of handling this.
only thing I can think of right now is using maya.mel.eval("python
string")
which I really don't like the idea of doing that.
any other ideas?
--
Todd Widup
Creature TD / Technical Artist
[email protected] <mailto:[email protected]>
[email protected] <mailto:[email protected]>
www.toddwidup.com <http://www.toddwidup.com>
--
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.