<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Run model in MXD using Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/run-model-in-mxd-using-python/m-p/686947#M53190</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm very new to python so please bear with me. I am trying to run a model that exports a .wm feature to a geodatabase feature class. The .wm file extension is for software that is used to update electrical utility data. The model has to be run in an .mxd because the .mxd contains an add-on that allows arcmap to read the .wm files. I'm having a problem getting the script to run successfully because it is not recognizing the .wm file even though the .mxd is open with the add-on enabled. Is there a way to prompt the model to run from the mxd rather than separately? Below is my script. Any incite would be much appreciated. Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import os&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;mxd = (r"D:\Milsoft\WindMilMap\WindmilMapExport\WindmilMapExport.mxd")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;os.startfile(mxd)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import time&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;time.sleep(50)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.ImportToolbox(r"D:\Milsoft\WindMilMap\WindmilMapExport\WindmilAutomation.tbx", "WindmilAutomation")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.ElectricWMtoGDB_WindmilAutomation()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESULT:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="151" src="https://community.esri.com/legacyfs/online/179473_pastedImage_3.png" style="height: 151px; width: 1017.61px;" width="1018" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Feb 2016 16:03:10 GMT</pubDate>
    <dc:creator>JosephSepulveda</dc:creator>
    <dc:date>2016-02-08T16:03:10Z</dc:date>
    <item>
      <title>Run model in MXD using Python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-in-mxd-using-python/m-p/686947#M53190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm very new to python so please bear with me. I am trying to run a model that exports a .wm feature to a geodatabase feature class. The .wm file extension is for software that is used to update electrical utility data. The model has to be run in an .mxd because the .mxd contains an add-on that allows arcmap to read the .wm files. I'm having a problem getting the script to run successfully because it is not recognizing the .wm file even though the .mxd is open with the add-on enabled. Is there a way to prompt the model to run from the mxd rather than separately? Below is my script. Any incite would be much appreciated. Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import os&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;mxd = (r"D:\Milsoft\WindMilMap\WindmilMapExport\WindmilMapExport.mxd")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;os.startfile(mxd)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import time&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;time.sleep(50)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.ImportToolbox(r"D:\Milsoft\WindMilMap\WindmilMapExport\WindmilAutomation.tbx", "WindmilAutomation")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.ElectricWMtoGDB_WindmilAutomation()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESULT:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="151" src="https://community.esri.com/legacyfs/online/179473_pastedImage_3.png" style="height: 151px; width: 1017.61px;" width="1018" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:03:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-in-mxd-using-python/m-p/686947#M53190</guid>
      <dc:creator>JosephSepulveda</dc:creator>
      <dc:date>2016-02-08T16:03:10Z</dc:date>
    </item>
  </channel>
</rss>

