-
PYKX not allowing to change Python attribute of Q Object
I am trying to do the following:
“`</p><p>import pykx</p><p>old=”:host:Port:user:old”</p><p>pykx.q.my_handle=old</p><p>new=”:host:Port:user:new”</p><p>pykx.q.my_handle=new</p><p>“`
The above works as expected. If I then try to access vía Python or directly from Q memory I would get the string in the new var.
“`</p><p>print(pykx.q.my_handle)</p><p>print(pykx.q(‘string .my_handle’))</p><p>“`
**However**, if I access the attribute (for any reason) before setting It to new value then something *weird* happens:
“`</p><p>import pykx</p><p>old=”:host:Port:user:old”</p><p>pykx.q.my_handle=old</p><p>print(f”my handled: {pykx.q.my_handle}”)</p><p>new=”:host:Port:user:new”</p><p>pykx.q.my_handle=new</p><p>#prints old</p><p>print(pykx.q.my_handle)</p><p>#prints new</p><p>print(pykx.q(“string .my_handle”))</p><p>“`
Anyone knows why? **Note** my handled has to be refreshed with new password/token whenever needed, in theory I vannot think about a use cas
Log in to reply.