If you put an empty __init__.py file in each folder then each folder is
treated like a module

so you could
import myPythonScript as mps
mps.modeling.pyScript1.myfunc()


//but I may be missing a bit in here


On Wed, Apr 22, 2009 at 2:15 PM, sberger <[email protected]> wrote:

>
> Hi, I have this folder structure where I put all my python scripts.
>
> myPythonScript
>  modeling
>  pyScript1.py
>  pyScript2.py
>  animation
>  pyScript1.py
>  shading
>  pyScript1.py
>  pyScript2.py
>  pyScript3.py
>  etc..
>
> In these script when I need a function from another script I import it
> like so:
> from myPythonScripts import pyScript1
> and I acces it like this:
> pyScript1.functionX()
>
> I seems to have hit a wall now because most of the script rely on
> other script. In each script I import another one, but I think I have
> a case where scriptA is importing scriptB and scritB is importing
> scriptA, thus causing a import error.
>
> I would like to know how I can setup my modules so that I can simply
> import everything once, and that each script can easily access script
> from a different folder.
>
> I hope my question makes sense.
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to