We can do works for a variety of reasons such as in order to embody our faith, in order to embody our love, in order to look good in the eyes of others, in order to experience a gift, in order to earn a wage, in order to build a relationship, in order to repair the world, and so forth, so it is important to recognize that the Bible can speak against being required to choose to do works for incorrect reasons without speaking against being required to choose to do them for correct reasons.This message is self-contradictory. Your first statement says that obedience to the law is not an entrance into heaven even if it is perfect obedience (which is consistent with your rejection of the Scriptures which tell us that the law demands perfect compliance and the Scriptures that tell us that those who perfectly obey the law have life because of their obedience, though they warn that no one will have gained eternal life that way which strangely you agree with in the first sentence). But in the second sentence, you contradict the first sentence when you claim that the entrance into heaven is through partially obeying the commandments because partial obedience to the law is how we come to know Jesus and knowing Jesus gets us into heaven (never mind that Jesus did not say that knowing Him is how people avoid judgement, but He said that Him knowing them was what is important). Please clarify whether or not you believe partial obedience to the law is required to get eternal life.
For example, Paul denied in Romans 4:1-5 that we can earn our righteousness even as the result of having perfect obedience to the Law of God while also affirming in Romans 2:13 that only the doers of it will be declared righteous, so there is a reason why our righteousness requires us to choose to be doers of it other than in order to earn it as the result, namely faith insofar as the faith by which we are declared righteous apart from works done to earn it also uphold the Law of God (Romans 3:28-31).
In Matthew 7:21-23, Jesus said that only those who do the will of the Father will enter the Kingdom of Heaven in contrast with saying that he would tell those who are workers of lawlessness to depart from him because he never knew them, so our entrance into the Kingdom of Heaven requires us to choose to do the will of the Father by being workers of lawfulness, but the reason why it requires us to be workers of lawfulness is not in order to be good enough to earn our way there as the result, rather Jesus saying that he would tell those who are workers of lawfulness to depart from him because he never knew them means that the goal of doing the will of the Father by being workers of lawfulness is to know him. In Exodus 33:13, Moses wanted God to be gracious to him by teaching him to walk in His way that he and Israel might know Him, and in 1 Kings 2:1-3, God taught how to walk in His way through His law, so the goal of the law is to teach us how to know God and Jesus, which is His gift of eternal life (John 17:3).
The Bible does not state that the way to have eternal life is by earning it as the result of perfect obedience, but rather you are reading that into it. For example, Jesus notably did not add that only those who [perfectly] do the will of the Father will enter the Kingdom of Heaven, but rather you are reading that into it. In Luke 10:25-28, Jesus affirmed that the way to inherit eternal life is by obeying the greatest two commandments, so that is a requirement, but he did not add that we need to [perfectly] obey them. In Roman 3:21-22, it does not state that the Law and the Prophets testify that the righteousness of God comes as the result of perfect obedience to the Law of God, but rather the only way to become righteous that is testified about in the Law and the Prophets is through faith in Christ for all who believe.
The Law of God came with instructions for what to do when His children sinned, so it never required perfect obedience. Repentance doesn't change the fact that we have no had perfect obedience, so if we needed to have perfect obedience, then repentance would have no value, but the fact that repentance has value demonstrates that we are not required to have perfect obedience. There would be no point in Jesus telling people who have already sinned that they need to have perfect obedience, but rather his message was one of repentance. There would also be no point in the Bible repeatedly stating that the way to have eternal life is by obeying the Law of God if that is an impossible way for anyone can have eternal life. In Deuteronomy 30:11-20, it says that the Law of God is not too difficult for us to obey and that obedience to it brings life and a blessing while disobedience brings death and a curse, so choose life! So it was not presented as an impossible way to have life, but as a possibility and as a choice that we can all make.
Obeying the Law of God has nothing to do with trying to be good enough for God.This reminds me of something someone told me on onother forum. He said something on the order of, "You don't have to be perfect, you just have to be good enough". Well, good enough won't cut it. That's why we're totally (not partially) dependent on Christ's sacrifice for our sins being sufficient to avoid His wrath.