It will because you’ve made a variable of the correct type, but has not assigned it to anything.
I can’t actually read your code, because it’s so small, but if that reference at the start is to a bottle ( for instance ), how is the system meant to know which bottle you’re talking about. You might have 10000 bottles in the scene.
You need to assign your bottle ( or whatever ) to the variable…
I assume you’re getting the ‘none’ error when you end play.