0

我正在尝试将变量从一个 Python 脚本导入到另一个。我通常会将from file1 import function1函数导入另一个脚本或函数。

**kwargs但是,当我尝试执行以下操作时,file1 中的 function1 是使用 so 定义的

from file1 import function1

我收到一个错误

ImportError: cannot import name 'function1' from 'file1' (script.py)

下面给出的是如何function1定义的

def function1(**kwargs):
    name = kwargs['customer_name']
    date = kwargs['sale_date']

    variable_name = xyz

    ----Remainder of the python script-----

我试图variable_name在一个新的 python 脚本/函数中调用它。

4

0 回答 0