Can’t execute `conda activate` from bash script

I am still new to Anaconda and I encountered this error

"Can't execute conda activate from bash script"

To resolve the issue was pretty fast. I took a look at https://github.com/conda/conda/issues/7980

source ~/anaconda3/etc/profile.d/conda.sh
conda activate my_env