Calling a setuptools entry point from within the library
<p>I have a setuptools-based Python (3.5) project with multiple scripts as entry points similar to the following:</p>

<pre><code>entry_points={
    'console_scripts': [
        'main-prog=scripts.prog:main',
        'prog-viewer=scripts.prog_viewer:main'
    ]}
</code></pre>

<p>So there is supposed to be a main script, run as <code>main-prog</code> and an auxiliary script <code>prog-viewer</code> (which does some Tk stuff).</p>

<p>The problem is that I want to be able to run the <code>prog-viewer</code> in a <code>Popen</code> subprocess from <code>main-prog</code> (or rather form my library) without having to resort to manually figuring out the paths and then adapt to the different OS. Also, what do I do when my PATH contains a script with the same name that does not belong to my library? Can I tell my program to <code>Popen(scripts.prog_viewer:main)</code>?</p>

<p>You could run a python command with Popen, for example:</p>

<pre><code>Popen('python -c "from scripts.prog import main; main()"', shell=True)
</code></pre>

python setuptools packaging