Below is the code in shell script
source /proj/common/tools/repo/etc/profile.d/repo.sh repo project init $branch repo project sync source poky/fnc-init-build
You need to add the path to 'bitbake', so it is found from your python script.
sys.path.append(your_path_there)