NameError: global name 'myExample2' is not defined # modules

后端 未结 5 1536
栀梦
栀梦 2021-01-12 03:48

Here is my example.py file:

from myimport import *
def main():
    myimport2 = myimport(10)
    myimport2.myExample() 

if __name__ == \"__main_         


        
5条回答
  •  心在旅途
    2021-01-12 04:23

    I see two errors in you code:

    1. You need to call myExample2 as self.myExample2(...)
    2. You need to add self when defining myExample2: def myExample2(self, num): ...

提交回复
热议问题