我试图从另一个.py初始化类(extraropt),但它给了我一个错误,我已经搜索但我没有找到解决方案.
下面是我正在调用的一个py的代码:
main.py:
class GameWindow(ui.ScriptWindow):
def __init__(self, stream):
import extraop
exec 'extraop.extraropt().Show(stream)'
Run Code Online (Sandbox Code Playgroud)
这里是我试图调用的一个py的代码(仅限init和del):
extraop.py
class extraropt(ui.Window):
def __init__(self, stream):
ui.Window.__init__(self)
self.BuildWindow()
self.stream=stream
def __del__(self):
ui.Window.__del__(self)
Run Code Online (Sandbox Code Playgroud)
它给出了这个错误:
Error - __init__() takes exactly 2 arguments (1 given)
Run Code Online (Sandbox Code Playgroud) python ×1