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>The problem is that you are trying to call that code from the class. Class should only contain methods, not your logic. You should call it from outside of the class:</p>

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

python