How to update an application created using algorand pyteal

I am phd student . I started working on algorand. I am facing issues while updating an application. I created application which diplays some message. Now I want to display some different message using same application id and creator account.
can anyone help me ragarding the issue with simple example of printing a message which writes the globle state and then the global state can be updated using CLI.

Welcome @nawazmalla, smart contracts can be updated only if their logic allows them to be. It depends on how you created your smart contract as to how you can update it.
You can find details on smart contract creation and updating on the Developer Portal

Would you provide me an example where I display the message and then I can update the same message.

I mean I want to change the arguments later…can you help me with an example

Thanks sir.

It would be better if you provide me the code where I can display some message and later I want to update the same .

Like I want to write a message cioa nullun.
Later when I update the program argument it should display some other message like cioa Nawaz.

Hope to hear from you soon

There’s a lot of different ways you can achieve this, but I’m going to give you the most basic approach using nothing but PyTeal.

from pyteal import *

def approval():
    return Seq(
        App.globalPut(Bytes("message"), Txn.application_args[0]),

if __name__ == "__main__":
    print(compileTeal(approval(), mode=Mode.Application, version=9))

This smart contract will store whatever you pass to it via the application arguments into global state. You can then read that global state wherever you need to. Checkout the PyTeal documentation to learn more. There are some good examples available too.