1

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 # 
starball
  • 20,030
  • 7
  • 43
  • 238
  • This looks a lot like a python2.7 to python3 problem. You can try to use ` from importlib import reload` if you are working with pyton3. – haggi krey May 23 '22 at 15:11
  • thanks where should i add that sorry inexperienced with python just trying to get my maya scripts to work? – Rebecca Quinn May 24 '22 at 13:43

2 Answers2

1

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()
Achayan
  • 5,720
  • 2
  • 39
  • 61
0

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()