Importing identically named methods
<p>So I have two separate Python packages that I'm importing into my Python script for Raspberry Pi. In this case as;</p>

<pre><code>from rflib import*
from Rpi.GPIO import*
</code></pre>

<p>However, both packages have their own seperate method <code>cleanup(self)</code></p>

<p>So, at the end of the script when I use the command
<code>cleanup()</code>, how do I a) know which package the method is coming from (they both do utterly different things b) control which one is run?</p>

<p>I've looked into similarly named <a href="http://stackoverflow.com/questions/21482427/two-classes-with-a-structurally-identical-method-but-one-differently-named-varia">questions</a>, but which seem to deal with inheritance overloading rather than package imports</p>

<p>It is not a good practice to use <code>*</code> with <code>import</code>. You should be doing something like:</p>

<pre><code>import rflib
from Rpi import GPIO

# Clean Up 1
rflib.cleanup

#Clean Up 2
GPIO.cleanup()
</code></pre>

<hr>

<p><em>Additional pice of information:</em> </p>

<p>In case your files/objects are of same name, in that case you should use <code>as</code> with <code>import</code>. For example:</p>

<pre><code>   from file1 import utils as file1_utils
   from file2 import utils as file2_utils

   file1_utils.my_func()
   file2_utils.my_func()
</code></pre>

python python-import