Importing custom python module into scripted extension

Hey all,
I have a custom python file asyncsocket.py that contains some code independent of 3d slicer. I am trying to import that module to use in a scripted widged by doing
import asyncsocket
howeveri get this
RuntimeError: qSlicerScriptedLoadableModule::setPythonSourc
apperently it is not a scripted loadable module. this is a generic python code that utilizes only core python function
asyncsocket.py is in the same directory as the slicer scripted widget

Thanks!

This topic should help:

1 Like

FYI this is the first google hit on the subject

this was fixed by placing the custom python file in a subdirectory (eg. comm) of the scriptable module and using

example: from comm import asyncsock

in comm folder there is

__init__.py

which contains

from .asyncsock import *