# How to call a function from the logic

**URL:** https://discourse.slicer.org/t/how-to-call-a-function-from-the-logic/6433
**Category:** Support
**Tags:** python
**Created:** [April 8, 2019, 3:46pm UTC](https://discourse.slicer.org/t/how-to-call-a-function-from-the-logic/6433 "2019-04-08T15:46:03Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [April 8, 2019, 8:03pm UTC](https://discourse.slicer.org/t/how-to-call-a-function-from-the-logic/6433/2 "2019-04-08T20:03:35Z")

</div>

Hi @siaeleni -

You should be able to do:

```auto
ModuleNameLogic().Test()

```

if you are in a different module file or in the python interactor you might need to call `import ModuleName` first.

(As an aside, the other ‘logic’ class `slicer.modules.moduleName.logic` is actually the C++ loadable module instance corresponding to the scripted module, but it’s really just an internal structure and doesn’t have any particular utility here).

-Steve

---

_[View the full topic](https://discourse.slicer.org/t/how-to-call-a-function-from-the-logic/6433)._
