In lines 391 and 392 in cube_interactive N is not defined. It works if you use self.cube.N instead of N.