def write_msg(rand_int, user_id, message):
vk.method('messages.send', {'peer_id': user_id,'message': message, 'random_id': rand_int})
from vk_api.utils import get_random_id
vk = vk_session.get_api()
vk.messages.send(
peer_id=event.obj.peer_id,
random_id=get_random_id(),
message='text
)