当引用某个模块时

例如

Testpython

import test

class test(object):
    def __init__():
    
        ……
        self.mimi = test
    
    def  test1():
        ……
        test2 = self.mimi.write()

那么在另一个文件中使用Testpython该文件的时候一定要注意实例化类test

import Testpython


action11 =  Testpython.test()

 

否则会出现__init__有定义但是运行提示AttributeError: 'str' object has no attribute……的情形