title: Python/Brython TypeError: Cannot use cached_property instance without calling __set_name__ on it
body: <p>I'm a network engineer, new to programming, so if I leave out any details do let me know. Trying my best to explain the problem here :) <strong>Getting a solution to this problem is very important for me</strong>, so any inputs would be <strong>highly appreciated</strong>.</p>
  
  <p><strong>Problem Statement:</strong>
  I wrote a python script, which is used by a brython script (used in html like javascript, converted to javascript at compile time). Basically <strong>when I click on a button on my webpage it triggers a python script</strong> which I have mentioned in my html like this:</p>
  
  <pre><code>*&lt;body onload="brython()"&gt;
  &lt;script type="text/python" src="ip_tools.py"&gt;&lt;/script&gt;*
  </code></pre>
  
  <p>The python script looks like this:</p>
  
  <pre><code>from browser import document as doc, bind
  import ipaddress
  def subcalc(ev):
      #Using the ipaddress module I get the ip_network, so the value ip will be like 192.168.1.0/24 (an object of ipaddress class)
      ip = ipaddress.ip_network(doc['ipadd'].value + '/' + doc['ipv4_mask'].value, strict=False)
  
      #This line gives the aforementioned error in Chrome Console
      *print(ip.hostmask)*
  
  doc["sub_cal"].bind("click", subcalc)  #This line triggers the subcalc function when user clicks on a button with id-"sub_cal" on the webpage.
  </code></pre>
  
  <p>The complete error from Chrome Console:</p>
  
  <pre><code>error in get.apply Error
      at _b_.TypeError.$factory (eval at $make_exc (brython.js:7647), &lt;anonymous&gt;:161:327)
      at __get__491 (eval at exec_module (brython.js:8991), &lt;anonymous&gt;:5898:62)
      at __BRYTHON__.builtins.object.object.__getattribute__ (brython.js:5332)
      at Object.$B.$getattr (brython.js:6731)
      at subcalc0 (eval at $B.loop (brython.js:5230), &lt;anonymous&gt;:120:48)
      at HTMLButtonElement.&lt;anonymous&gt; (brython.js:12784) brython.js:5334 get attr hostmask of Object brython.js:5335 function () { [native code] } brython.js:6108 Traceback (most recent call last): TypeError: Cannot use cached_property instance without calling __set_name__ on it.
  </code></pre>
  
  <p><strong>I have similar script working fine</strong>, the only difference is that this script uses an imported Python library other scripts do not use such libraries, except the browser library (which is required by Brython to work with html content)</p>