0

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

4

1 回答 1

2

在包含addon.pyvideo.py模块的目录中添加一个空__init__.py文件来定义包。

+- your_package/
        |- __init__.py  
        |- addon.py
        |- video.py

Python 包

于 2013-09-19T08:15:18.837 回答