'Telethon Is Not sending The Code to Sign up With New Number using send_code_request

ph = input("Enter Phone Number: ")
    async def sign_up():
        try:
            x = await bot.send_code_request(ph, force_sms=True)
            print(x)
        except Exception as e:
            print(e)
            print("Error")
            return
        print("Code Sent")

I am Trying To Request Code to Sign Up and i want this to create New account by using this method

await bot.sign_up(code =code,
    first_name= name, 
    phone = ph)

Actually My Question is:

  1. Do We need Existing Client to do this Method if not - How can i achieve this..
  2. Sign_up Method Needs Self what to do here?
  3. Is this method will really work or do i need any other methods?


Solution 1:[1]

For this i made small mistakes.. there should be alredy client and from that client you can create it

Solution 2:[2]

The phone number is in international format? country code + phone number

Example for Malaysia phone: 60123456789, where 60 is country code and 123456789 is phone number.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rohithaditya
Solution 2 Simon Yong