def isValidLanguage(self): #If user input is in json import json f = open('Translation.json') json_dict = json.load(f) self.answer = True while self.answer == True: translationLanguage = Language.getLanguage(self) if translationLanguage in json_dict: return translationLanguage elif translationLanguage not in json_dict: print("You put an invalid language!\n") self.answer = True