<HTML>
<HEAD>
<TITLE>Re: [Paraview] Passing a python script parameters</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I have no idea what the problem is. &nbsp;If you use the &#8220;Run Script&#8221; button to run the LoadMultipleFiles.py file, it creates a LoadMultipleFiles() function just like if you used the &#8220;from X import Y&#8221; command (which, incidentally, should also work assuming your python path is correct). &nbsp;I just tried it and it works fine.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 5/12/09 12:58 PM, &quot;David Doria&quot; &lt;<a href="daviddoria@gmail.com">daviddoria@gmail.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>In the python shell, there is a &quot;Run Script&quot; button. It seems that you can only run scripts that do not require parameters? If I have a python function in a .py file, how would I call it? In normal python, I would import the function like this (the listdir was just to show you I was in the correct directory):<BR>
<BR>
<BR>
&gt;&gt;&gt; os.listdir(&quot;.&quot;)<BR>
<BR>
['IterateOpenSources.py', 'IterateOpenSources.py~', 'LoadMultipleFiles.py', 'LoadMultipleFiles.py~', 'Sphere.py']<BR>
<BR>
&gt;&gt;&gt; from LoadMultipleFiles import *<BR>
<BR>
and here is the contnets of LoadMultipleFiles.py<BR>
--------------------------<BR>
#!/usr/bin/pvpython<BR>
def LoadMultipleFiles(FilePrefix, Low, High):<BR>
    #setup paraview connection<BR>
    from paraview import servermanager<BR>
<BR>
    if not servermanager.ActiveConnection:<BR>
        connection = servermanager.Connect()<BR>
<BR>
    pm = servermanager.ProxyManager()<BR>
    #actually do something here<BR>
---------------------------<BR>
<BR>
You can see the function requires a couple of parameters - how can I pass them?<BR>
<BR>
Thanks,<BR>
<BR>
David<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
&nbsp;&nbsp;&nbsp;**** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kenneth Moreland<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sandia National Laboratories<BR>
*********** &nbsp;<BR>
*** *** *** &nbsp;email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** &nbsp;*** &nbsp;** &nbsp;phone: (505) 844-8919<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;web: &nbsp;&nbsp;<a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>