from Avatar import PlayerAvatar class AAA(object): def __init__(self): pass pre_onEnterWorld_init = PlayerAvatar.onEnterWorld pre_onLeaveWorld_init = PlayerAvatar.onLeaveWorld def new_onEnterWorld_init(current, prereqs): pre_onEnterWorld_init(current, prereqs) self.currentPlayer = BigWorld.player() def new_onLeaveWorld_init(self): pre_onLeaveWorld_init(self) PlayerAvatar.onEnterWorld = new_onEnterWorld_init PlayerAvatar.onLeaveWorld = new_onLeaveWorld_init AAA()
В итоге ругается на:
*** File "", line 34, in new_onEnterWorld_init *** NameError: global name 'pre_onEnterWorld_init' is not defined