tough to say. You could try printing the resources, it should have a matching address if they truly are the same; otherwise you may want to compare the resources by a variable, like the item name.
Like @gertkeno said, it’s hard to say with the information you provided.
Is that one script or two?
What is that script attached to?
What kind of object or data structure is inventory?
Where is the interact() function getting the variable data?
Where does the Resource file come in?
What does inventory.Items return?
I’m pretty sure that using in as a comparison only really works well with primitives: bool, int, float, char, maybe strings. Otherwise like @gertkeno said, your objects probably have to have the same memory address to be equal.