title: bazel run from a running py_binary
body: <p>I've got a py_binary and another runnable target. I want to <code>bazel run //:the_inner</code> the second target (which could be a py_binary as well) from the first target <code>bazel run //:the_outer</code></p>
  <pre><code>py_binary(
    name=&quot;the_outer&quot;,
    srcs=[&quot;the_outer.py&quot;]
  )
  
  py_binary(
    name=&quot;the_inner&quot;,
    srcs=[&quot;the_inner.py&quot;]
  )
  </code></pre>
  <p>A simple</p>
  <pre class="lang-py prettyprint-override"><code>rv = subprocess.run( &quot;bazel run //:the_inner&quot;.split(), capture_output=True, text=True)
  </code></pre>
  <p>Gives me a error message, telling me I shouldn't do this and tells me the workspace I should have used. At this point I just parse the error message and call the second target again.</p>
  <pre class="lang-py prettyprint-override"><code>workspace = re.search( r&quot;'(\.\w/)+'&quot;. rv.stderr ).group(1)
  subprocess.run( &quot;bazel run //:the_inner&quot;.split(), cwd=workspace)
  </code></pre>
  <p>It works, but the solution is extremly awkward. Is there a canonicial way of <code>bazel run</code>ning stuff from another <code>bazel run</code>, particularly for python?
  Solutions I have seen include</p>
  <ul>
  <li>resolving the symlinks in the sandbox and hoping you end up in the workspace</li>
  <li><code>find / -name WORKSPACE</code> and hoping there is only one</li>
  <li>wrapping everything in a shell script and passing <code>bazel info workspace</code> as a parameter</li>
  </ul>
  <p>No, it shouldn't be done. No don't care - not if there are so many simple workarounds</p>