Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How are you executing bar.py? I am assuming you are going to run it as a package, because that's how you designed it. Or else, <code>from test import foo</code> in the second version of bar.py doesn't make much sense as <code>test</code> would not be recognized by bar.py unless it is run as a package. </p> <p>Have a look at the python docs for <a href="http://docs.python.org/tutorial/modules.html#intra-package-references" rel="nofollow">Intra-package references</a>. They talk mainly about two kinds of references. Say, you are trying to import uber.py from foo.py. One way to do this is by, explicit relative reference of the kind <code>from .sup import uber</code>. Another way to do this, is by absolute reference and this would be of the form <code>from test.sup import uber</code> or <code>import test.sup.uber</code></p> <p>It looks like you are using absolute references through out except in <code>foo.py</code>. Here, you are effectively calling <code>__import__('sup.uber')</code> where as it should have been <code>__import__('test.sup.uber')</code>. I am not sure if this is what is causing the error that you reported, but I was able to get both versions of bar.py to run using, </p> <p>I got both versions of <code>bar.py</code> to run by using this in <code>foo.py</code>:</p> <pre><code>__import__(("%s.%s" % ('test.'+plugindir, f))[0:-3]) </code></pre> <p>Also, how are you running bar.py as a package? One way to do this would be to include a <code>import test.bar</code> line in a script outside the <code>test</code> dir and then run it. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload