Python 2.7 为什么调用类时出现python错误…不能;见;功能

Python 2.7 为什么调用类时出现python错误…不能;见;功能,python-2.7,Python 2.7,很抱歉问了一个简单的问题……但我已经花了将近一个小时试图找出问题所在。我不是一个超级有经验的python人,但从几个月前在学校开始,我已经写了大约1000行代码 我已经把它简化为这个 “正在调用”.py pgm: “称为”wclass1.py pgm类: class wclass1(): # def wfunction1(receivedString): print(receivedString) return win10/Spyder下

很抱歉问了一个简单的问题……但我已经花了将近一个小时试图找出问题所在。我不是一个超级有经验的python人,但从几个月前在学校开始,我已经写了大约1000行代码

我已经把它简化为这个

“正在调用”.py pgm:

“称为”wclass1.py pgm类:

class wclass1():
#        
    def wfunction1(receivedString):
        print(receivedString)
        return
win10/Spyder下py2.7的错误消息: AttributeError:“模块”对象没有属性“wfunction1”

我相信这一定很简单。有人能帮我克服这个困难吗?谢谢….

打电话给.py

from wclass1 import wclass1
passingString = "this is test"
wclass1().wfunction1(passingString)
wclass1.py

class wclass1():
#        
    def wfunction1(self, receivedString):
        print(receivedString)
        return
输出

这是测试

我从类中删除了一些代码,如init和self,以使其静音,但可能删除的代码太多了。我正在试着写一个里面有函数的类。谢谢chinmay,它对我的也有效,现在我有一些东西要处理。非常感谢!
class wclass1():
#        
    def wfunction1(self, receivedString):
        print(receivedString)
        return