I created a znc script usind modpython. When I try to import a second helper script into my custom module, I get an import error for the script I'm trying to import. Here's an example of the issue:
mymodule.py
importzncimportmymodulehelper# throws an ImportError exceptionclassfoo:defOnLoad(self,args,msg):self.PutModule('Loaded....')# ...
I created a znc script usind modpython. When I try to import a second helper script into my custom module, I get an import error for the script I'm trying to import. Here's an example of the issue:
`mymodule.py`
``` python
import znc
import mymodulehelper # throws an ImportError exception
class foo:
def OnLoad(self, args, msg):
self.PutModule('Loaded....')
# ...
```
folder structure
```
| ~/.znc/modules
| mymodule.py
| mymodulehelper.py
```
Any help would be greatly appreciated.
<!-- github-sync-id:148916183 -->
It's better to be a different directory from ~/.znc/modules/ though. Files in ~/.znc/modules/ are intended to be loaded from ZNC as a module, not from python using import.
ZNC doesn't add path to modules to `sys.path`, you can do it yourself.
``` py
import sys
sys.path.append('/path/to/helpers')
import mymodulehelper
```
It's better to be a different directory from `~/.znc/modules/` though. Files in `~/.znc/modules/` are intended to be loaded from ZNC as a module, not from python using `import`.
<!-- github-comment-id:210990229 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I created a znc script usind modpython. When I try to import a second helper script into my custom module, I get an import error for the script I'm trying to import. Here's an example of the issue:
mymodule.pyfolder structure
Any help would be greatly appreciated.
ZNC doesn't add path to modules to
sys.path, you can do it yourself.It's better to be a different directory from
~/.znc/modules/though. Files in~/.znc/modules/are intended to be loaded from ZNC as a module, not from python usingimport.