Refer to defined variable from function outside Python class
Question: Excuse for newbie question but I want make all clear for myself. I have a
problem accessing class variable from within function outside the class. In
code below I need **`text, text2`**. I get variables as tuple but I need them
separately. How to update code to get defined variable like **`text = var1`**
and **`text2 = var2`**? Thanks in advance!

    
    
    from django.shortcuts import render
    
    class Someclass():
        def method_1(self):
            self.var2 = 'var2'
            self.var1 = 'var1'
            return self.var1 ,self.var2
    
    def func(request):
        cls = Someclass()
        text2 = cls.method_1()
        text = cls.method_1()
        content = {
            'text': text,
            'text2': text2,
        }
        return render(request, "web/page.html", content)
    


Answer: Since you are returning a tuple you should directly assign their values to
variables in a single call.

Something like this:

    
    
    text, text2 = cls.method_1()
    

