Reload(module) not working as advertised?

I’m discovering that reload(module) in Maya(2015) actually refuses to work (pretends to work?)

I’m sending code from pycharm into maya to reload said module and then executing… (don’t work in maya’s script editor either)

No code changes in the module are reflected after a reload and I have to kill maya and restart it…

is this just me or is this something more sinister?

I found this thread on CGTalk… but no dice there either

it’s possible for this to happen if your .py files are confused about their mod dates: you change the source but for whatever reason python does not now that the pycs are invalid and continues to use them in preference to the pys. If you delete all the pycs in your work space you may have better luck

A way to avoid the pycs thing when you’re doing development work it to set the PYTHONDONTWRITEBYTECODE environment variable.

Also sometimes reload can be down right tricky, depending on what your code looks like.

yeah cool… thanks for the input… I’m doing Qt menu dev at the moment and it seems tricky anyhow to reload modules under the regime anyhow…

will battle on…

out

reload only works on the current file being reloaded - it doesn’t pick any changes to files that the original file imports.
if you need to reload dependencies, you need to use something like the reimport module.

I get this issue all the time. While working with multiple python files(I stay organized that way), I just add the reload under the import. THen removed all the reloads when I deploy.

i.e.


import derpOne as dOne
reload(dOne)

import derpTwo as dTwo
reload(dTwo)

import derpThree as dThree
reload(dThree)

Class derpy():
    def __init__(self, daDerp):
        self.doIt()

    def doIt(self):
        pass