你好,我正在尝试从另一个文件导入我的函数。我已经使用from my_script import *从脚本顶部的那个文件导入了所有内容。然而,{I希望从这个函数中导入另一个函数。但是当我尝试导入所有我需要的函数而不是一个,from my_script import function_1, function_2, function_3并调用它时,Python抛出错误:cannotimport name'function_1'。在def iphone_5_routine():
from create_files import create_display_file_5
print('Please state the issue using one of the following keywords', keywords)
issue = str(input('Issue: '))
if issue == keywords[0]:
f = open('displaysolutions.txt','r') #Make a text file with the iPhone display solutions
lines = f.readlines()
print(lines[0])
issue = input('Has the issue been solved?').lower()
if issue == 'no':
print(lines[1])
else:
print('Thanks for using the phone diagnostics tool')
issue = input('Has the issue been solved?').lower()
if issue == 'no':
print(lines[2])
create_display_file_5()
else:
print('Thanks for using the phone diagnostics tool')
from create_files import create_speaker_file_5
if issue == keywords[1]:
f = open('speakersolutions.txt','r') #Make a text file with the iPhone display solutions
lines = f.readlines()
print(lines[0])
issue = input('Has the issue been solved?').lower()
if issue == 'no':
print(lines[1])
else:
print('Thanks for using the phone diagnostics tool')
issue = input('Has the issue been solved?').lower()
if issue == 'no':
print(lines[2])
create_speaker_file_5()
else:
print('Thanks for using the phone diagnostics tool')
这是我试图在另一个脚本中调用的函数:
^{pr2}$