Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python import class from local folder

Tags:

python

pydev

I have 2 classes. The first is named test and goes as following:

import textbox
class test:

    a=textbox("test")
    a.run()

the second class is textbox and goes as following:

class textbox():
    def __init__(self, string):
        self.string=string
    def run(self):
        print string

i get this error

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

I use the pydev eclipse plugin

like image 836
John Avatar asked Oct 24 '25 16:10

John


1 Answers

Try

a = textbox.textbox("test")

or alternatively use

from textbox import textbox
like image 80
silvado Avatar answered Oct 26 '25 06:10

silvado