I’m trying to use a data dictionary to house names for fields that return numerical values but it seems only string values are being returned.
I have a data dictionary that looks like this:
dicts= {“BrdTemp_dict”: {“UpperLimit_Parameter”:155, “LowerLimit_Parameter”:156, “Temp_Volt”:“Temp”, “SOH":"SOH.BrdTemp.floatval()”}, “BrdVolt_dict”: {“UpperLimit_Parameter”:143, “LowerLimit_Parameter”:144, “Temp_Volt”:“Volt”, “SOH”:“SOH.BrdVolt.floatval()”}}
SOH represents a field that returns a numerical value and is normally accessed like this: current_board_temp = SOH.BrdTemp.GetFloatVal()
However, I’m trying to make the script more flexible by adding the field names in the dictionary but when I access that using: current_board_temp = dicts[dictionary_name][“SOH”]
current_board_temp returns a string that it seems Python won’t recognize as a field that can be used to get the numerical value.
Is there a way to make: current_board_temp = dicts[dictionary_name][“SOH”] the same as: current_board_temp = SOH.BrdTemp.GetFloatVal() returning a field name instead of a string or can the string be converted?