Many people believe this to be true. You might believe it to be true. I used to believe it to be true, until I experienced otherwise.
You can have any personality trait you wish. If one person can be one way then so can another. If someone you know is confident in one situation, you can be confident in that situation too.
It’s called modelling.
You can model yourself on someone you know. Exactly what is this person seeing, hearing and feeling when they behave in a certain way?
If you allowed yourself to see, hear and feel the same, could you perhaps display the same behaviour?
I think you could.