Python从另一个文件导入多个函数,所有函数都在一个函数中

Python从另一个文件导入多个函数,所有函数都在一个函数中,python,Python,您好,我正在尝试从另一个文件中导入我的函数。我已使用my_script import*中的从脚本顶部的该文件导入了所有内容。但是,由于我想从另一个函数中调用这些导入的函数,我已经从函数中分别导入了它们来自我的脚本导入功能\u 1-此功能正常工作。但是,当我尝试从我的_脚本导入函数_1、函数_2、函数_3并调用它时,Python抛出错误:无法导入名称“函数_1” def iphone_5_routine(): from create_files import create_display_file

您好,我正在尝试从另一个文件中导入我的函数。我已使用my_script import*中的
从脚本顶部的该文件导入了所有内容。但是,由于我想从另一个函数中调用这些导入的函数,我已经从函数中分别导入了它们<代码>来自我的脚本导入功能\u 1
-此功能正常工作。但是,当我尝试从我的_脚本导入函数_1、函数_2、函数_3并调用它时,Python抛出错误:无法导入名称“函数_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')
这是我试图在另一个脚本中调用的函数:

     from Task_3_developed_script import *

     def create_display_file_5():
     global case_number
     case_number += 1
     global case_numbers
     case_numbers.append(case_number)
     f = open('{0}.txt'.format(case_numbers[0]),"w")
     f.write("Device: Phone  Model: iPhone 5 Problem: Display")
     f.close()
     print('The case has been exported to a file ready for the technician')
     print('The case number is: ',case_number)

    def create_speaker_file_5():
    global case_number
    case_number += 1
    global case_numbers
    case_numbers.append(case_number)
    f = open('{0}.txt'.format(case_numbers[0]),"w")
    f.write("Device: Phone  Model: iPhone 5 Problem: Speakers")
    f.close()
    print('The case has been exported to a file ready for the technician')
    print('The case number is: ',case_number)

请添加您的代码和文件结构。请添加代码,这样有助于更好地理解问题。您的代码中肯定缺少一些缩进…@PrestonM这是我复制并粘贴代码的地方,缩进正确