Ulm-IQO / qudi-core

A framework for modular measurement applications.
GNU General Public License v3.0
38 stars 21 forks source link

Tasks outside qudi-core are not found #96

Open simon1schmitt opened 6 months ago

simon1schmitt commented 6 months ago

Version

Development

What is affected by the bug?

Similar to adding additional fit-methods, I expected that it would be possible to include tasks by placing the corresponding python files into 'src/qudi/tasks' of a different project (so not qudi-core). This, however, seems not to work. After moving these python files into the tasks-folder of the qudi-core-module, everything works as expected (so python syntax or similar should not be the problem).

When does the bug occur?

Whenever trying to add tasks from a different project.

How do we replicate the issue?

In a different project (for example the qudi-iqo-modules), create a folder under 'src/qudi/tasks' and put a corresponding file into it (for example simply copy present test_task file and change the task names).

Expected behavior

From my understanding, it should be possible to add tasks without putting them into the qudi-core-project directly.

Relevant log output

Exception during activation:

ModuleNotFoundError: No module named 'tasks.my_test_tasks'
Traceback (most recent call last):

  File "...\qudi-core\src\qudi\core\module.py", line 301, in __activation_callback
    self.on_activate()

  File "...\qudi-core\src\qudi\logic\taskrunner.py", line 61, in on_activate
    task = import_module_script(module, cls, reload=self._consecutive_activation)

  File "C:\Users\simon.schmitt\dev\repos\qudi\qudi-core\src\qudi\core\scripting\modulescript.py", line 243, in import_module_script
    mod = importlib.import_module(module)

  File "C:\Users\simon.schmitt\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import

  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load

  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked

Additional Comments

Removed personal file paths in stack trace.

Contact Details

simon.schmitt@diatope.com