I want to use LocalSubmit
to create continuous tasks that run in parallel. But it not works with functions from packages. For example:
BeginPackage["pack1`"];
func1[] := "function 1"
EndPackage[]; (*pack1`*)
BeginPackage["pack2`"];
Needs["pack1`"]
func2[] := LocalSubmit[func1[] >> "test.txt"]
EndPackage[]; (*pack2`*)
And if I run this code:
Needs["pack2`"]
func2[]
the following is written to the file test.txt:
func1[]
I know how this problem can be resolved if packages in files pack1.m and pack2.m. func2
must be defined as follows:
func2[] := LocalSubmit[Get["pack1`"]; func1[] >> "test.txt"]
There may be a better solution that saves the functions from the loaded contexts??