Also you have to reload your modules in the correct order.

Example.

You have a module that defines a base class and some other generic module
methods.  m1.py
You then have m2.py that uses m1 base class.


myBetterClass(m1.baseCalss):
    pass

reloading m1 after m2 will cause all sorts of errors as the metaclass mro
has been broken.

What I've done is write a _Reload() function in the root module.  It walks
the imports in order and reloads the modules if it hasn't already been
reloaded.




On Thu, Aug 30, 2012 at 1:00 PM, Mike Malinowski (LIONHEAD) <
mich...@microsoft.com> wrote:

>  Yes, that is also a way to do it, but I find it hard to manage when
> dealing with lots of dependencies, because it often means you have to go
> through all your altered files at the end and remove the reloads ( because
> you don’t really want them released to your team as it just slows things
> down ). I guess it depends a lot on your module dependency complexity.****
>
> ** **
>
> As a side note, if you do do that, you can skip the final import and do
> this :****
>
> ** **
>
> import m1
> m1 = reload(m1)****
>
> ** **
>
> *From:* python_inside_maya@googlegroups.com [mailto:
> python_inside_maya@googlegroups.com] *On Behalf Of *kimmo ala-ojala
> *Sent:* 30 August 2012 12:58
> *To:* python_inside_maya@googlegroups.com
> *Subject:* Re: [Maya-Python] How to get the updated module everytime in
> maya****
>
> ** **
>
> import m1
> reload(m1)
> import m1
>
> # imports the module
> # reloads the module
> # imports the reloaded module****
>
> On 30.8.2012 14:15, Mike Malinowski (LIONHEAD) wrote:****
>
> We have a ‘tech deployment tool’ that we run within Maya for this.
> Essentially it’s a python script which runs through all our tech directly
> and looks for python modules, for each one it will then attempt to reload
> the module. It will also attempt to resource mel files, and
> unload/sync/reload mll plugins.****
>
>  ****
>
> The downside is that as your toolset grows the process becomes a little
> slower, which is a hassle when you know you have only altered x amount of
> files, but it does ensure you’re working with the latest versions from the
> point you called the script. This is then implemented into our menu so our
> TA’s can update all plugins on demand whilst they develop. This is only
> triggered manually by our TA’s, so once we release our tools there is no
> overhead for our Art/Animation teams, except on the initial load of Maya
> where all the tools are initially sourced.****
>
>  ****
>
> Mike.****
>
>  ****
>
> *From:* python_inside_maya@googlegroups.com [
> mailto:python_inside_maya@googlegroups.com<python_inside_maya@googlegroups.com>]
> *On Behalf Of *PBLN RAO
> *Sent:* 30 August 2012 12:09
> *To:* python_inside_maya@googlegroups.com
> *Subject:* [Maya-Python] How to get the updated module everytime in maya**
> **
>
>  ****
>
> Hi All,
>
> i am developing a tool which has so-many modules to be imported within the
> modules.
>
> for suppose if i have below 3 modules
> m1,m2,m3.
>
> py is my python file used in maya
>
> py imports m1
> m1 imports m2
> m2 imports m3
>
> while developing we will be coming across some errors, which we will be
> correcting where it is required.
>
> so here when i execute the py file.
> if i got an error at m2 module. we will be fixing the issue in an IDE.
> after correcting the module if we run py file it uses the same old m2
> module which was imported 1st. for that to get effected i need to close
> maya and reopen and run py again.
>
> i want to skip this closing and opening maya every time i do a change in
> any module.
>
> How can i overcome this...?
>
> Can any one give any idea.****
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe****
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe****
>
> ** **
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe****
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>



-- 
David Moulder
http://www.google.com/profiles/squish3d

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to