Hi Naveen,
Where are you using this functions ? In a provisioning job ? or in initial load/ normal jobs.
The problem is with the uGetIDStore function. This function returns the id store ID if it is called from a provisioning job. Else it always returns 0.
In your case, I believe the uGetIDStore is returning always 0, as you are not calling it from a provisioning job thus resulting in no such attribute error message.
So, hardcode the ID store value in the script or the best way is to use the MASTER ID store constant in the global constants.
All the best !!
~ Krishna.