Calling functions from another python script in Fiji


I’m new to writing python scripts for Fiji. I was wondering if there was a way I can call a function from another .py file.

I have

def Hello():
	print "Hello"

I want to call Hello() from

from Hello_ import Hello

def main():


I get the error message:

line 1, in <module>
    import Hello
ImportError: No module named Hello_

I’m running them in the Fiji Script editor and both files are in the same folder.

I’d do:

import sys
sys.path.append("/path/to/folder/")  # the folder containing
from Hello_ import Hello


Note as well that, by inspecting the sys.path entries, you can find out which folders are already included. One of them is your If you add subfolders to Lib/, you can access the .py files
and their functions in them like:

from myfolder.Hello_ import Hello