Reputation: 25691
I've my main code in addon.py
In the same folder, there is video.py
In addon.py I do
import video
video.play(params)
In video.py
print 'loaded'
def play(params)
..... [omitted code]
When executing, I got an error, because
Error Contents: 'module' object has no attribute 'play'
Also: the print
is NOT executed.
What's wrong ? It seems that the module is not loaded, but if I try to add a syntax error to the file, the compiler warn me about it, so I'm a lot confused
I tried to rename to my_video, and the error is the same
Upvotes: 0
Views: 101
Reputation: 7295
In the directory with addon.py
and video.py
modules add an empty __init__.py
file to define the package.
+- your_package/
|- __init__.py
|- addon.py
|- video.py
Upvotes: 2