first, answering your code specific question, passing the key properly, it is not a callable:
deferred.defer(my_deferred.a_function, entity.key)
next, on the actual design of the code itself, there are some things that need tweaking.
- the deferred api serializes your code, so there really is no need to re-query entity from the datastore. if you insist on this though, passing the
entity.key
to the deferred method, it's already an instance ofndb.Key
, so there's no need to construct a new Key object.