I will praise thee with uprightness of heart, when I shall have learned thy righteous judgments. Psalms 119:7 KJV
It is impossible to have communion with God while having your own way. The only way to God is through Jesus, the Christ, the Messiah of Israel . . .
Jesus saith unto him, I am the way, the truth, and the life: no man cometh unto the Father, but by me. John 14:6 KJV
. . . and by being intimately acquainted with His Word (the Bible) so that you willingly and joyfully live by its precepts.
Then, your praise is received by and pleases God.