KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums PyKX PYKX not allowing to change Python attribute of Q Object

  • PYKX not allowing to change Python attribute of Q Object

    Posted by Nachofest on May 17, 2025 at 12:44 pm

    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

    rocuinneagain replied 1 week, 5 days ago 2 Members · 1 Reply
  • 1 Reply

Log in to reply.