<?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 Re: Python Submit File fails right after package installation (timing issue) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910181#M106909</link>
    <description>&lt;P&gt;Using Read Function("text") is one option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

RP = Run Program(
	Executable("PING.EXE"/*path probably not needed*/ ),
	Options({"-n 5", "localhost"}),
	ReadFunction("text")
);

Show(RP);
Write("\!NDONE");&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 Oct 2025 10:26:00 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-10-28T10:26:00Z</dc:date>
    <item>
      <title>Python Submit File fails right after package installation (timing issue)</title>
      <link>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910165#M106906</link>
      <description>&lt;P data-start="511" data-end="528"&gt;Hello,&lt;/P&gt;
&lt;P data-start="530" data-end="759"&gt;I’m currently developing a JMP add-in that relies on embedded Python scripts.&lt;BR data-start="607" data-end="610" /&gt;At startup, the add-in installs the required Python packages (using a local wheel repository) before executing any Python code.&lt;/P&gt;
&lt;P data-start="761" data-end="973"&gt;The issue I’m facing is that, when the add-in is launched for the first time, it sometimes fails to execute the embedded Python functions defined in the files submitted right after the package installation.&lt;/P&gt;
&lt;P data-start="975" data-end="1308"&gt;It looks like JMP continues executing the script &lt;STRONG data-start="1024" data-end="1093"&gt;before the PowerShell installation process has actually completed&lt;/STRONG&gt;.&lt;BR data-start="1094" data-end="1097" /&gt;The error I get is &amp;nbsp;that Python cannot find one of the functions defined in the two &lt;STRONG data-start="1216" data-end="1305"&gt;&lt;CODE data-start="1277" data-end="1297"&gt;Python Submit File&lt;/CODE&gt; calls&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P data-start="1310" data-end="1468"&gt;After the first successful installation, everything works fine (probably because the packages are already present and the scripts are then loaded properly).&lt;/P&gt;
&lt;P data-start="1470" data-end="1506"&gt;&lt;STRONG&gt;How can I make sure that JMP waits until the PowerShell installation process is fully completed before running &lt;CODE data-start="2547" data-end="2569"&gt;Python Submit File()&lt;/CODE&gt;?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-start="1470" data-end="1506"&gt;Here’s the relevant part of my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;strPathjpip = dest_path || "\jpip.bat";
If( !File Exists( strPathjpip ),
	Python Send( dest_path );
	Python Submit( "
import jmp
import jmputils
jmputils.create_jpip(dest_path)

" );
);


// Build command to run
cmd = Eval Insert( "\[&amp;amp; "^strPathjpip^" install --no-index --find-links "^strPathPythonLibs^" numpy pandas scipy]\" );


Eval( Eval Expr( commands = {Expr( cmd )} ) );
				

icommand = 0;

		// Use Run Program to execute the script
rp = Run Program(
	Executable( "PowerShell.exe" ),
	ReadFunction( Function( {this}, Write( this &amp;lt;&amp;lt; Read ) ) ),
	WriteFunction(
		Function( {this},
			icommand++;
			If( icommand &amp;lt;= N Items( commands ),
				this &amp;lt;&amp;lt; Write( commands[icommand] ),
				this &amp;lt;&amp;lt; WriteEOF
			);
		)
	)
);


// Include Python scripts
Python Submit File( strPathAddin || "include/PYTHON/exttolint.py" );
Python Submit File( strPathAddin || "include/PYTHON/normtolint.py" );
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Oct 2025 09:32:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910165#M106906</guid>
      <dc:creator>SophieCuvillier</dc:creator>
      <dc:date>2025-10-28T09:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python Submit File fails right after package installation (timing issue)</title>
      <link>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910181#M106909</link>
      <description>&lt;P&gt;Using Read Function("text") is one option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

RP = Run Program(
	Executable("PING.EXE"/*path probably not needed*/ ),
	Options({"-n 5", "localhost"}),
	ReadFunction("text")
);

Show(RP);
Write("\!NDONE");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Oct 2025 10:26:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910181#M106909</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-10-28T10:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python Submit File fails right after package installation (timing issue)</title>
      <link>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910372#M106934</link>
      <description>&lt;P&gt;Thank you !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2025 10:18:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-Submit-File-fails-right-after-package-installation-timing/m-p/910372#M106934</guid>
      <dc:creator>SophieCuvillier</dc:creator>
      <dc:date>2025-10-29T10:18:26Z</dc:date>
    </item>
  </channel>
</rss>

