win32.Dispatch vs win32.gencache in Python. What are the pros and cons? : <p>I have been recently using win32com.client from python as an API for windows applications but am struggling to understand some basic things.</p>

<p>I had been using it with a program called WEAP, in the following way</p>

<pre><code>import win32com.client
win32com.client.Dispatch("WEAP.WEAPApplication")
</code></pre>

<p>Now, I want to use it with Excel and have found alternatives to the previous lines, one of them as follows (taken from <a href="https://stackoverflow.com/questions/39877278/python-open-excel-workbook-using-win32-com-api">Python: Open Excel Workbook using Win32 COM Api</a>)</p>

<pre><code>import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
</code></pre>

<p>Does anyone know the difference between using </p>

<pre><code>win32.Dispatch 
</code></pre>

<p>and </p>

<pre><code>win32.gencache.EnsureDispatch
</code></pre>

<p>and other alternatives? Does anyone know pros and cons of each one? or some advice regarding when one or another should be used?</p>

<p>I have looked for advice and i have found some useful answers, eg:</p>

<p><a href="https://stackoverflow.com/questions/39877278/python-open-excel-workbook-using-win32-com-api">Python: Open Excel Workbook using Win32 COM Api</a></p>

<p><a href="https://stackoverflow.com/questions/11623461/win32com-client-dispatch-works-but-not-win32com-client-gencache-ensuredispatch">win32com.client.Dispatch works but not win32com.client.gencache.EnsureDispatch</a></p>

<p><a href="http://pythonexcels.com/python-excel-mini-cookbook/" rel="noreferrer">http://pythonexcels.com/python-excel-mini-cookbook/</a></p>

<p><a href="https://mail.python.org/pipermail/python-win32/2011-August/011738.html" rel="noreferrer">https://mail.python.org/pipermail/python-win32/2011-August/011738.html</a></p>

<p>However, they are usually focused on answering specific issues, and not describing the bigger picture of the differences between Dispatch, gencache.EnsureDispatch, and perhaps further alternatives, which is what i want.</p>

<p>Any advice would be greatly appreciated.</p>
