NameError: global name ‘***‘ is not defined [How to Solve]

Error demonstration

class Solution(object):
    def fib(self,n):
        """
        :type n: int
        :rtype: int
        """
        while(n>0):
            if(n==1 or n==2):
                return 1
            else:
                return fib(n-1)+fib(n-2)#error
        return 
'''
NameError: global name 'fib' is not defined
    return fib(n-1)+fib(n-2)
Line 11 in fib (Solution.py)
    ret = Solution().fib(param_1)
Line 36 in _driver (Solution.py)
    _driver()
Line 48 in <module> (Solution.py)
'''        

Solution:

class Solution(object):
    def fib(self,n):
        """
        :type n: int
        :rtype: int
        """
        while(n>0):
            if(n==1 or n==2):
                return 1
            else:
                return self.fib(n-1)+self.fib(n-2)#Modified
        return 0

Read More: