Using within another build script

I’m trying to write a build script for a package that depends on PyCall.jl. In this build script, a new Conda environment gets created for PyCall to then bind to.

PyCall binds to a specific Python executable by calling"PyCall") with the PYTHON environment variable set to this executable. As such, my package’s build.jl looks something like

using Pkg
PROJECT_DIR = dirname(dirname(@__FILE__))
run(`conda create --name jl_env python=3.7 --file $(joinpath(PROJECT_DIR, "requirements.txt"))`)
python_exe = chomp(readchomp(`conda run -n jl_env which python`))
ENV["PYTHON"] = python_exe"PyCall")

When building my package, I get the following error:

ERROR: LoadError: ArgumentError: Package Pkg not found in current path.
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

I’m taking this to mean that build scripts run in a separate environment where Pkg is not accessible? This makes sense, but is there any nicer way of rebuilding PyCall with the new Conda environment within the build process, rather than users of my package having to separately run a post-build script?