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

    
    
    entry_points={
        'console_scripts': [
            'main-prog=scripts.prog:main',
            'prog-viewer=scripts.prog_viewer:main'
        ]}
    

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

The problem is that I want to be able to run the `prog-viewer` in a `Popen`
subprocess from `main-prog` (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
`Popen(scripts.prog_viewer:main)`?


Answer: You could run a python command with Popen, for example:

    
    
    Popen('python -c "from scripts.prog import main; main()"', shell=True)
    

