I have no idea what the problem is.  If you use the "Run Script" button to run 
the LoadMultipleFiles.py file, it creates a LoadMultipleFiles() function just 
like if you used the "from X import Y" command (which, incidentally, should 
also work assuming your python path is correct).  I just tried it and it works 
fine.

-Ken


On 5/12/09 12:58 PM, "David Doria" <[email protected]> wrote:

In the python shell, there is a "Run Script" 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):


>>> os.listdir(".")

['IterateOpenSources.py', 'IterateOpenSources.py~', 'LoadMultipleFiles.py', 
'LoadMultipleFiles.py~', 'Sphere.py']

>>> from LoadMultipleFiles import *

and here is the contnets of LoadMultipleFiles.py
--------------------------
#!/usr/bin/pvpython
def LoadMultipleFiles(FilePrefix, Low, High):
    #setup paraview connection
    from paraview import servermanager

    if not servermanager.ActiveConnection:
        connection = servermanager.Connect()

    pm = servermanager.ProxyManager()
    #actually do something here
---------------------------

You can see the function requires a couple of parameters - how can I pass them?

Thanks,

David



   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: [email protected]
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to