Rebecca Quinn
Rebecca Quinn

Reputation: 21

Maya script won't run in Maya 2022. `reload` is not defined

Trying to run a script that works fine in maya 2018 but wont in 2022

import gw_anim_clip
reload(gw_anim_clip)
gw_anim_clip.anim_clip_ui()

I'm getting this error:

Error: name 'reload' is not defined
Traceback (most recent call last):
  File "<maya console>", line 2, in <module>
NameError: name 'reload' is not defined # 

Upvotes: 2

Views: 4445

Answers (2)

Ilia Sobert
Ilia Sobert

Reputation: 11

Maya 2022 use python 3.7 and you need to import reload first.

from imp import reload
import gw_anim_clip
reload(gw_anim_clip)
gw_anim_clip.anim_clip_ui()

Upvotes: 1

Achayan
Achayan

Reputation: 5895

reload is not available in python 3.9 and maya 2022 already in 3.9. So you have to use importlib.reload to reload a module.

import importlib
import gw_anim_clip
importlib.reload(gw_anim_clip)
gw_anim_clip.anim_clip_ui()

Upvotes: 1

Related Questions