Python web service and DMZ
If you want the service itself to run on dedicated hardware within the network and have the webserver itself hosted on the DMZ you'll have to use a proxy. You can use Nginx (for instance) to forward the port in which you're exposing the webserver to the port opened by flask on the dedicated machine. You'll have to configure your firewall to forward that port so that it's accessible to the machine in the DMZ.
I'd provide the configuration for your firewall and Nginx but it really depends on the parameters of your network and the service you want to run.
I have written a python library and a web service using flask to expose functions from that library. The library should run on computer A (to do its processing). In our IT setup, web servers will run on a DMZ (computer B). This being the case, if the flask web service directly imports the library and runs a function, it would be running on the DMZ, rather than the intended computer? How do I design the program such that the library executes on the intended hardware, but the web service is hosted by the webserver on the DMZ?