Hey Justin, I have appended the module path to the system python path under
the ART directory
sys.path.append( '%s' % os.environ['MAYA_TOOLS_REPO']) #tools repo is Art
I am still getting that error if I use windows path string or dot path. I
tried using imp to load the modules before I started this question, but
it's still giving me errors: *No module named Art.Scripts.myModule #*
fp, pathname, description = imp.find_module('Art.Scripts.%s' % Module)
module = imp.load_module(name, fp, pathname, description)
Trying to use the system path to load the modules seem a little confusing,
since I don't think I can do that directly, everything I read online is
either by direct path eg "C:/Some_dir/foo.py" and it also works if I use
the entire path (Not the system path).
Am I able to do it with imp? Because It's returning me an IOError 'Using
dot path and windows slash pathing':
module = imp.load_source('myF**kingAnoyingModule', 'Art/Scripts/%s.py' %
Also Thanks Alok Gandhi for helping!
On Tue, Nov 29, 2016 at 6:17 PM, Justin Israel <justinisr...@gmail.com>
> On Wed, Nov 30, 2016 at 2:17 PM I73 <wesley.keel...@iugome.com> wrote:
>> I am trying to import a module with the __import__ because I want to
>> dynamically call a method from multiple modules this is the original import
>> from Art.Scripts import MyScript as myScript
>> What I would like to do is something like this:
>> module = __import__ ('Art/Scripts/%s' % Module)
>> getattr(module, 'Run')
>> How can I achieve this, when it's saying *Import by filename is not
>> supported. #*
>> Thanks guys!
> The __import__() function expects you to use the same semantics as the
> normal import keyword, where you are specifying a dot-style module path,
> i.e. foo.bar.biz.baz. But it lets you do it like a function call with
> strings. So you would be expected, in this case, to use a format like
> "Art.Scripts.MyModule" and the "Art" location would need to be on the
> If what you actually want is to directly work with known absolute paths to
> files, then you should be looking at the "imp" module, and specifically at
>> 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 python_inside_maya+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> For more options, visit https://groups.google.com/d/optout.
> You received this message because you are subscribed to a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> To unsubscribe from this group and all its topics, send an email to
> To view this discussion on the web visit https://groups.google.com/d/
> For more options, visit https://groups.google.com/d/optout.
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 view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.