Function1 creates sprite1. It then calls function 2.
Function2 creates sprite2 and pins it to sprite1. In order for function2 to be able to select sprite1, I pass sprite1's UID as a parameter. So when function2 is called, it attempts to select sprite1 from the passed UID, but it doesn't work.
Even if I give sprite1 a variable and choose it directly in function2, it still doesn't work. It's as though sprite1 hasn't even been created at the moment I reach function2.
Do I need to leave the first function in order for the newly created sprite to be recognised by further function?