Home Youtube GitHub

Reload all of mGear


I found this method interesting; https://github.com/krathjen/studiolibrary/blob/698ece88a02e32f7c8764e539bdb9cd61febbb97/src/studiolibrary/utils.py#L135

When it come to UIs, you could potentially register all and destroy them with a common method.


Interesting! I didn’t know about the del sys.modules[mod]
I will investigate more this.

This is the part that really needs to be improved, do you have any example for this?



No. I would maybe dig deeper in the studiolibrary repository and see how they do it.



Using del sys.modules[your_module_name] is the cleanest way to totally remove a python module been loaded in your session. This is what I use all the time even for Synoptic pickers you just del the picker module name so that you don’t have to restart maya or whatsoever. I would actually prefer if the reload modules from mgear did just that. A hard module del from the current Maya session. That is way more cleaner than using reload. This is the reason I don’t need to always build mgear to develop and the main reason I wanted full namespace on all repositories. Basically I have a Maya setup in which I am adding python paths to the real code (no build) and I use del module whenever I did an update on the code so it’s faster than building.


Nice! thanks for the advice!