Create and Update 2 CPT sequentially

I’ve found a solution, which I’m not liking much, but it works

Essentially what I do is create two hooks to save_post (in this case this is the action that launches this script) with different priorities for example 10 and 20
In the priority 10 I put the wp_insert_post
And in the priority 20 I put the wp_update_post

It works, but is doesn’t seem to be the best solution…

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)