For some reason, I can’t edit an imported global variable, nor it’s temporary copy.
Every change I make results in the original variable being ignored.
Example:
from router import PRESETCHOICE #WORKS FINE, I THINK?...
xbmcgui.Dialog().textviewer('ORIGINAL', PRESETCHOICE) #OUTPUTS THE CORRECT STRING
copy = PRESETCHOICE #CREATES A COPY, I HAVE ALSO TRIED USING COPY(), SAME RESULT: WORKS BUT ANY CHANGES CLEAR THE PRIOR VALUE INSTEAD OF MODIFYING IT.
xbmcgui.Dialog().textviewer('COPY', copy) #OUTPUTS THE CORRECT STRING
broken = PRESETCHOICE + 'anything' # SHOULD CREATE A STRING CALLED 'broken' AND APPEND 'anything' to prior string, WILL IN FACT IGNORE IT.
xbmcgui.Dialog().textviewer('broken', broken) #ONLY OUTPUTS THE WORD 'anything'
The only workaround I found was to edit the global variable in the module where I got it from, but I want to understand why this happens. I can’t seem to wrap my head around it.
Thanks in advance!
New contributor
DutchGreen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.