session with another python file ?
It's not for scam or spam or . . .
Why isn't it possible? pass the session file name to TelegramClient usually
I want to make a telegram bot my telegram accounts are in that folder I need to send my phone number to bot and bot run the app.py for my number folder has this struccher 1- bot.py (Telegram bot) 2- app.py 3- [folder]Accounts
Do so, name the session as phone.session. code your app.py to handle with passed arguments when running it from bot.. and pass that phone to TelegramClient(session=)
Bro I'm a little confused . Would You give me another description please. app.py: from telethon import TelegramClient, events client = TelegramClient('myphonenumber', my_api_id, my_api_hash) client.start() @client.on(events.NewMessage) async def new_message(event): await event.reply("Hey !") client.run_until_disconnected() bot.py (telegram bot): this code handles if event.raw_text + '.session' file exists , runs that .
it's not telethon issue. use subprocess.Popen/run, and memorize the pid to kill it later. it will run it same as python app.py phone, then get "phone" from sys.argv, pass it to TelegramClient, or any other way
Обсуждают сегодня