NameError:名称“move”是注释定义的(函数)

2024-09-30 05:26:32 发布

您现在位置:Python中文网/ 问答频道 /正文

嘿,我一直在做一个迷宫游戏,我写了一个函数让角色(机器人)移动。问题是Python说我的函数不是define

NameError: name 'move' is not defined

但是我定义了它,并在主文件中导入了函数文件。 这是我的函数文件(经过修改,所以有点干净)

import pickle

from classes.labyrinthe import *
from roboc import *
from carte import *
from creer_labyrinthe import *

def move(oldLab, direction, steps):
    global isOnExit
...
return oldLab

这是我的主文件(再次修改…)

import os

from classes.carte import Carte

from fonctions.receiveRobotMoves import *
from fonctions.move import *
...
isOnExit = False
while isOnExit == False: #Tant que le robot n'est pas sur la sortie...
    #On demande au joueur la direction qu'il veut prendre
    receiveRobotMoves()

    #On fait avancer le robot
    conteneur = move(Labyrinthe, movesInformation['direction'], 
movesInformation['steps'])
    #On met à jour le labyrinthe
    Labyrinthe = conteneur

你能告诉我我能做些什么使它工作吗。你知道吗


Tags: 文件函数fromimportlemoveonsteps

热门问题