You could probably dispatch the
LearnTalents() call to a
C_Timer.After() function.
Code:
/run C_Timer.After(1,function() LearnTalents(a,b,c,d,e,...) end)
The first argument to
C_Timer.After() is how many seconds to delay running the function defined as the second argument.