Cannot import module in new plugin

Asked by Nicolas Chachereau

I'm trying to create a Kupfer plugin for the Hamster Time Tracking applet [1].

In order to avoid recreating a client class doing the D-Bus messaging, I wanted to import a module already existing in Hamster. However, I can't import this client class into my Kupfer plugin which fails because of this [2].

However, it works perfectly inside Python [3], which means Kupfer's custom import somehow restricts valid imports. Is this a feature (i.e. wanted behaviour) or a bug? If it isn't a bug, why can't I import this file, and what can I do instead? Do I really need to rewrite my own client class?


Question information

English Edit question
kupfer Edit question
No assignee Edit question
Solved by:
Karol Będkowski
Last query:
Last reply:
Revision history for this message
Best Karol Będkowski (karol-bedkowski) said :

Your plugin also have name "hamster" so importing "client" from "hamster" you try to import client from plugin module.
Simplest solution - please rename your plugin to - in example - ""

Revision history for this message
Nicolas Chachereau (nicolas-chachereau) said :

Thanks Karol Będkowski, that solved my question.

Revision history for this message
Nicolas Chachereau (nicolas-chachereau) said :

Thanks a lot, that should have been obvious. My python skills are obviously rusty!

Revision history for this message
teranex (teranex) said :

Would it be possible to post the code somewhere online? I'm interested in this plugin, but the links to are not valid anymore... Thx!