How to create an unique ID in ignition

I need to generate a unique trackid in ignition. At the moment i store this in a memory tag and after each read, i increase the value by 1, using the and write functions. My question is: is it possible for 2 scripts to read and write values at the same time? This breaks the uniqueness of the id. Is it possible to program a function which returns a unique id, and can be called from gateway and client?

You can use

import uuid
print uuid.uuid4()