On Tue, Oct 17, 2017 at 9:44 AM jettam <[email protected]> wrote:

>
>  At the moment if I add a path to my Maya.env   I only get to read the
> give path, not all its sub-folders too?
>

That is how the PYTHONPATH and import mechanism work in Python. You add a
path and it makes packages/modules accessible below that point, with their
namespaces rooted to the PYTHONPATH. Example:

PYTHONPATH=myRootPath

myRootPath/
    |- foo
    |- foo2
        |- bar
            |- baz

Then you can do the following imports:

import foo
import foo2
import foo2.bar.baz
from foo2.bar import baz


>
> PYTHONPATH = E:\ProfessionalDevelopment\python\Introduction to Python
> Scripting in Maya\cgcircuitPython\;
> E:\ProfessionalDevelopment\python\Introduction to Python Scripting in
> Maya\cgcircuitPython\.     # I thought adding a . here would be saying
> from here and everything below. It didn't work.
>

Not sure where you found information suggesting this would work the way you
thought.


>
>
> Also. Once I have updated the Maya.env how can I get Maya to reload it.
> Currently I have to restart Maya ?
>

Yes, the Maya.env gets read when Maya starts up. If you change it, you need
to restart Maya.

What is your intended workflow that you are trying to solve? What kind of
imports are you trying to access that require some kind of recursive
appending to the PYTHONPATH? Can you make use of the namespaced imports
like I suggested earlier, to access nested packages?

If you are trying to dynamically update the PYTHONPATH within a running
Maya session, then you would need to update the values of sys.path

import sys
print sys.path


> --
> 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/2cf1397b-f276-44e8-86d6-e8553da74191%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/2cf1397b-f276-44e8-86d6-e8553da74191%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3VnsVEgpdxOnsn3N0eTc8mTghe2yTF%2Bzt_hdVNuP6ENw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to