call function_A that lives in core.py from a function_B that lives in core.py wihout use the subprocess module in python

7 views
Skip to first unread message

jose Garcia

unread,
Mar 28, 2023, 10:41:18 AM3/28/23
to iRODS-Chat
I want to run the next but I dont know how to do it inside of the core.py

#core.py
....

def function_A(rule_args, callback,rei):
(......)
    callback.writeLine("stdout", "I want to be called  and do things with my friend function_B")

def function_B(rule_args, callback,rei):
   # How do i call function_A ? and how I can get the output from it
callback.writeLine("stdout", "life is good when I call my friend ".format(var))
....

Thanks!

Jose

Alan King

unread,
Mar 28, 2023, 11:09:02 AM3/28/23
to irod...@googlegroups.com
Hi,

Is there a reason function_B cannot call function_A with the arguments that it receives? In other words, does this work?

def function_B(rule_args, callback,rei):
    function_A(rule_args, callback, rei)

We have a demonstration of calling rules from native rule engine plugin rulebases in our training, but not within the same language. Perhaps worth adding to some documentation...

Alternatively, if it is possible for your use case, you could split out the relevant logic in function_A to a separate function and call that from function_B. Obviously, that might not be possible, but I just didn't want to leave that stone unturned :)

Hope that helps!

--
--
The Integrated Rule-Oriented Data System (iRODS) - https://irods.org
 
iROD-Chat: http://groups.google.com/group/iROD-Chat
---
You received this message because you are subscribed to the Google Groups "iRODS-Chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to irod-chat+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/irod-chat/7f0832d9-4973-4d87-9847-e736e934c251n%40googlegroups.com.


--
Alan King
Senior Software Developer | iRODS Consortium
Reply all
Reply to author
Forward
0 new messages