Why the self.driver that returns return self.driver is not a global variable that can be called at any time?

def qimingpian_login(self, url):
        """"""
        self.driver.maximize_window()
        self.driver.get(url)
        self.driver.implicitly_wait(3)
        self.driver.find_element_by_xpath("//div[@class="fl tab-phone hand"]").click()
        user = self.driver.find_element_by_xpath("//*[@class="form-con dib phone-input"]")
        user.send_keys(self.phone_number)
        self.driver.find_element_by_xpath("//*[@id="code-btn"]").click()
        time.sleep(2)
        code = input("")
        pwd = self.driver.find_element_by_xpath("//*[@class="form-con code-input fl"]")
        pwd.send_keys(code)
        time.sleep(0.5)
        self.driver.find_element_by_xpath("//*[@id="phone-login"]").click()
        time.sleep(20)
        return self.driver

    def shijian_login(self):
        
        pass
    def login(self):
        """ ishijian """
        print("")
        self.driver = self.qimingpian_login( self.login_url)
        cookies=self.driver.get(self.shijian_url)
       
Mar.20,2021

self.driver is an instance variable, and only instances of the class are available, not global. If you haven't defined it before, AttributeError will appear when you use it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32d9f-2be2d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32d9f-2be2d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?