样本1.py
class1:
def function(self):
dbcursor.execute('UPDATE Table')
主文件
from sample1 import class1
inventoryDb = inventory.connect('sample.db')
dbcursor = inventoryDb.cursor()
class = class1()
class.function()
NameError:未定义全局名称“dbcursor”