title: Modify a Python object's attribute when using PyCall.jl in Julia
body: <p>I'm trying to interface with a python library via PyCall.jl where the library returns a python object (PyObject in Julia) with attributes I want to modify in Julia. For example say I have the following dummy python class,</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  
  class MyNumpy:
       def __init__(self,n,m):
            self.array = np.zeros((n,m))
            self.size = (n,m)
  
  </code></pre>
  
  <p>Now in Julia I load this python class using PyCall.jl and instantiate, something like:</p>
  
  <pre><code>using PyCall
  
  mynumpy = pyimport("MyNumpy.MyNumpy")
  pyobject = mynumpy(3,3)
  ...
  
  &gt; pyobject.array
  &gt; 3×3 Array{Float64,2}:
    0.0  0.0  0.0
    0.0  0.0  0.0
    0.0  0.0  0.0
  ...
  
  pyobject.array[1,1] = 1.0 
  
  &gt; pyobject.array
  &gt; 3×3 Array{Float64,2}:
    0.0  0.0  0.0
    0.0  0.0  0.0
    0.0  0.0  0.0
  
  </code></pre>
  
  <p>The last line of code executes without any error, however upon investigation of the <code>pyobject.array[1,1]</code> the value has not changed (i.e., remains 0.0).</p>
  
  <p><strong>How would one accomplish changing a Pycall.jl PyObject attribute value in Julia, for example, can I use pointers do this, if so how?</strong> Sorry if this is obvious but I've had no luck and can't figure out how to do so using the PyCall.jl documentation. Thanks in advance.</p>
  
  <p>P.S. The actual python library is not something that can be easily modified.</p>