Python: how to make a function visible throughout a program
<p>I have two functions like the following:</p>

<pre><code>def fitnesscompare(x, y):    
    if x.fitness&gt;y.fitness:
        return 1
    elif x.fitness==y.fitness:
        return 0
    else:  #x.fitness&lt;y.fitness
        return -1
</code></pre>

<p>that are used with 'sort' to sort on different attributes of class instances.</p>

<p>These are used from within other functions and methods in the program.</p>

<p>Can I make them visible everywhere rather than having to pass them to each object in which they are used?</p>

<p>Thanks</p>
