I have two python files.
1)plan.py
2)manager.py
plan.py - is like below.
import manager
def plan(baseDir=None):
m = manager.managerLogic(baseDir)
m.load(‘plan’)
plan()
Whenever I tried like below commands Its working using python interacter in slicer.
import plan
plan.plan()
But when i try like below. Its not working.
import plan
I have added above file inside scripting file also. (compile_Slicer_python_scripts.py). building is also fine.
ctk_compile_file(‘D:/W2/S-r/S-bld/Slicer-build/lib/Slicer-4.13/qt-scripted-modules/plan.py’, force=1)
May I know what is the issue here?
Why python module is not initiating by default?
I got some error message after launching the application. The log looks like below.
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “”, line 1, in
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “D:\W2\S-r\S-bld\python-install\Lib\imp.py”, line 170, in load_source
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - module = _exec(spec, sys.modules[name])
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “”, line 618, in _exec
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “”, line 678, in exec_module
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “”, line 219, in _call_with_frames_removed
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “D:/W2/S-r/S-bld/Slicer-build/lib/Slicer-4.13/qt-scripted-modules/plan.py”, line 11, in
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - plan()
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “D:/W2/S-r/S-bld/Slicer-build/lib/Slicer-4.13/qt-scripted-modules/plan.py”, line 9, in plan
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - m.load(‘plan’)
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - File “D:/W2/S-r/S-bld/Slicer-build/lib/Slicer-4.13/qt-scripted-modules/manager.py”, line 524, in load
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - lm.setLayout(3)
[CRITICAL][Stream] 07.02.2022 10:24:19 [] (unknown:0) - AttributeError: ‘NoneType’ object has no attribute ‘setLayout’
[CRITICAL][Qt] 07.02.2022 10:24:19 [] (unknown:0) - loadSourceAsModule - Failed to load file “D:/W2/S-r/S-bld/Slicer-build/lib/Slicer-4.13/qt-scripted-modules/plan.py” as module “plan” !
[CRITICAL][Qt] 07.02.2022 10:24:19 [] (unknown:0) - Fail to instantiate module “plan”