Yes, it should be enough to start the installation of the script immediately before executing the ROS command, for example:
from subprocess import Popen, PIPE
shell_setup_script = "/some/path/to/workspace/devel/setup.sh"
command = "echo $ROS_PACKAGE_PATH"
cmd = ". %s; %s" % (shell_setup_script, command)
output = Popen(cmd, stdout=PIPE, shell=True).communicate()[0]
print(output)
As you can see, it is used shell=True, which will execute cmdin a subshell. It then cmdcontains . <shell_setup_script>; <command>which starts the installation of the script before executing the command. Note that the file is .shused instead .bash, since the general POSIX shell is likely to be used by Popen.