import json # Config = { # api_token: "xxxxxxxx" # } Config = {} def config_load(): global Config try: file = open('config.json', 'r') Config = json.load(file) file.close() except IOError: Config = {'api_token': ''} def config_save(): global Config with open('config.json', 'w') as file: json.dump(Config, file, indent=4)