You got to save it.
Example:
local item = ...
local game = item:get_game()
function item:on_created()
-- Define the properties of key.
self:set_savegame_variable("key")
self:set_assignable(true)
end
function item:on_obtaining()
game:set_item_assigned(1, self)
end