It's hard to tell what's going wrong from a screenshot. The best way to post this would be a simplified version of your project in a zip file, but the new forum software doesn't allow that, so you'd have to post a link from somewhere else.

If I were you, I'd use the debugger to step through the code and make sure that you're actually getting a working object at that point, that the object does have a texture, and that the texture object still exists. When you find the point at which it ceases to exist, you can probably figure out what's going wrong.

By the way, the only difference moving your script would make is the paths you'd have to use to find something, assuming the object the script is attached to continues to exist. It should function the same anywhere.

You cannot separate statements onto multiple lines like that. It's an error in GDSCript, unless you escape it.

This is an ERROR:

var num = 
9

This is OKAY:

var num = \
9

    Tienux

    If the texture property is null, then either you're looking in the wrong place, or the texture object doesn't exist at the time you're looking for it (either before or after), or the property cannot take the data type you're trying to assign. I can't tell which without seeing the project. Make sure you look for any errors or warnings in the debugger.

    cybereality This is an ERROR:

    var num = 
    9

    This is OKAY:

    var num = \
    9

    IIRC a special case is things encapsulated in brackets I think.

    It's probably best if you only use get_node() on the top onready to get the node reference, not the texture. Then you can access the texture inside the function.

    If you are switching the whole scene of the game, then nothing will be saved. You have to save the user's choices in a Dictionary and pass it to the next scene somehow (maybe with an Autoload, or by saving to a file).

    It depends how you are saving. If you use the save_var() function, then it will be binary, so you can use any extension (or none at all), it doesn't matter. You can also save the texture names as strings, in which case JSON would make the most sense.