TypeError: fun() missing 1 required positional argument: 'link'
<p>I am facing a basic problem and unable to resolve it. I am getting this error</p>

<blockquote>
  <p>TypeError: fun() missing 1 required positional argument: 'link'</p>
</blockquote>

<p>If i give <code>self</code> as positional argument in call of <code>fun()</code> as <code>fun(self,glit)</code> then I an getting </p>

<blockquote>
  <p>Undefined Variable self</p>
</blockquote>

<p>There is no indentation problem in this small function. I also tried <code>self.fun(glit)</code> But it is also giving</p>

<blockquote>
  <p>Undefined Variable self.</p>
</blockquote>

<p>If I delete the word <code>self</code> from <code>def fun(self,link):</code> then it is also not working. 
Any way out?</p>

<pre><code>class myClass:

    def fun(self,link):
        print("fun")

    glit = "http://www.google.com"
    fun(glit)
</code></pre>

<p>[Edit]
Use the <code>__init__</code> function to set variables inside of a class, like</p>

<pre><code>def __init__(self): 
    self.glit = 'www.google.com'
</code></pre>

<p>Now use <code>self.fun(self.glit)</code></p>

python