python多个函数定义在一个文件_Python从另一个文件导入多个函数,所有函数都在一个函数中...

你好,我正在尝试从另一个文件导入我的函数。我已经使用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}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值