New command #408
Replies: 2 comments
-
Hi, I noticed that the stack documentation on the wiki still lists the old way of defining new stack functions. Since some time you can also define new stack commands with python decorators. The example plugin also contains an example of this: https://github.com/TUDelft-CNS-ATM/bluesky/wiki/plugin If you've defined a function that you want to register as stack function, the general syntax is: from bluesky.stack import command
@command
def myfun(a, b):
#function code here. You can specify argument types with annotations, and can give a stack command name as argument to the command decorator. I'm sure there are more examples in the various plugins in the plugin folder. |
Beta Was this translation helpful? Give feedback.
-
Thanks for answering, good to know. Checking the area.py example I noticed I forgot to add stackfunctions to the return of init_plugin.
Now it works. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I want to add a new command to connect to a server and download scenarios. I've been reading the stack module part of the documentation but I have some doubts. I created a plugin file since it says: "more functions can be added to the stack from BlueSky plugins". But, where does the definition of the new command go when the new command comes from a plugin? I mean this:
Should I add the new command to BLUESKY-COMMAND-TABLE.TXT? Is there any example available of plugin adding a new command?
Beta Was this translation helpful? Give feedback.
All reactions