Hello, is it possible to use an `op` inside anothe...
# ask-community
i
Hello, is it possible to use an
op
inside another
op
? I want to use
shell_op
inside my custom
op
j
hey @Ignas Kizelevičius calling an op within another op is not supported/ an anti-pattern. Instead you could do something like this
Copy code
@op
def before_shell_op():
    # do computation
    return value

@op 
def after_shell_op(x):
     # do computation on x

@job 
def my_job():
       value = before_shell_op()
       shell_out = shell_op(value) 
       after_shell_op(shell_out)
i
Hi @jamie, thanks for the answer. The shell command materializes an asset, thus I wanted to log the materialization in the same op
j
huh interesting. another option would be to just directly execute the command within your op using
subprocess
rather than using the
shell_op
i
Yeah i guess thats my next option, thanks 🙂