How to generate Hash160 from a private key with the Bitcoin module I want to fix the script code. The script generates from a random private key Bitcoin Address by function (pubtoaddr) and works
on the Bitcoin module:
https://github.com/primal100/pybitcointools/blob/master/cryptos/main.py
from bitcoin import *
import os

    priv = random_key ()
    pub = privtopub (priv)
    addr = pubtoaddr (pub)

....
....

But I need to get from a Random Private Key in Hash160
For some reason I could not find such a function in main.py
I searched and found an article
&gt;&gt;&gt; import pybitcointools
&gt;&gt;&gt; privkey = pybitcointools.random_key ()
&gt;&gt;&gt; privkey
'34030ce14e32ac982419b3683af3b59d64a29cc93798cf479d610af49d425d13'
&gt;&gt;&gt; pubkey = pybitcointools.privtopub (privkey)
&gt;&gt;&gt; pubkey
'04ce0ed35340803b0c21f2f7f5d5ab9d687e5fa95a79471c9b5c9d97a0bb170eac1045230cc51d13b85a5f64feb80f8fc19358a396797926e3f89d49066b1abc07'
&gt;&gt;&gt; h160 = pybitcointools.hash160 (pubkey.decode ('hex'))
&gt;&gt;&gt; h160
'1558c7cd9825447a31990ff964f347bb2dbfe9be'
&gt;&gt;&gt; addr = pybitcointools.hex_to_b58check (h160)
&gt;&gt;&gt; addr
'12wsYc4B9c9JeREqstLZXNWa3n4i42M5jg'

Unfortunately I could not get from
 priv = random_key ()  --- &gt; Hash160

How to do it?
I am using a different bitcoin library. This prints address and hash160 from a private key:

from bitcoinutils.setup import setup
from bitcoinutils.keys import P2pkhAddress, PrivateKey, PublicKey

def main():
    # setup the network
    setup('testnet')

    # provide a private WIF key
    priv = PrivateKey.from_wif('cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87K7XCyj5v')

    # get the public key
    pub = priv.get_public_key()


    # get address from public key
    address = pub.get_address()


    # print address and hash160
    print("Address:", address.to_string())
    print("Hash160:", address.to_hash160())

    print("\n--------------------------------------\n")



if __name__ == "__main__":
    main()




For segwit addresses you can refer to this example: https://github.com/karask/python-bitcoin-utils/blob/master/examples/keys_segwit_addresses.py