# Qt-scripted-modules are not recognising using python interacter in slicer

**URL:** https://discourse.slicer.org/t/qt-scripted-modules-are-not-recognising-using-python-interacter-in-slicer/21838
**Category:** Development
**Tags:** python
**Created:** [February 7, 2022, 1:49pm UTC](https://discourse.slicer.org/t/qt-scripted-modules-are-not-recognising-using-python-interacter-in-slicer/21838 "2022-02-07T13:49:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Mahesh\_Timmanagoudar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mahesh_timmanagoudar/32/10914_2.png) [@Mahesh\_Timmanagoudar](https://discourse.slicer.org/u/Mahesh_Timmanagoudar)
#### Post date: [February 7, 2022, 1:49pm UTC](https://discourse.slicer.org/t/qt-scripted-modules-are-not-recognising-using-python-interacter-in-slicer/21838/1 "2022-02-07T13:49:35Z")

</div>

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”
