work related moving expense

Hi Tax Expert,

 

I moved from CA to MA for a new job in very end of 2020 and stayed in a apartment for a few months in 2021. I visited my home in CA twice and bought a house in 2021. Can I still claim my work related moving expenses (house purchasing, apartment rental, traveling, etc. ) in my 2021 tax return? Thank you.