Python从本地文件夹导入类

Joh*_*ohn 3 python pydev

我有2节课.第一个是命名测试,如下所示:

import textbox
class test:

    a=textbox("test")
    a.run()
Run Code Online (Sandbox Code Playgroud)

第二个类是文本框,如下所示:

class textbox():
    def __init__(self, string):
        self.string=string
    def run(self):
        print string
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

File "C:\Users\User\Desktop\edoras\gui\test.py", line 4, in test
    a=textbox("test")
TypeError: 'module' object is not callable
Run Code Online (Sandbox Code Playgroud)

我使用pydev eclipse插件

sil*_*ado 7

尝试

a = textbox.textbox("test")
Run Code Online (Sandbox Code Playgroud)

或者使用

from textbox import textbox
Run Code Online (Sandbox Code Playgroud)