1

https://github.com/dtcarls/ff_bot https://github.com/dtcarls/ff_bot/blob/master/ff_bot/ff_bot.py

I am trying to figure out a way to manually have this python script run certain functions, like get_trophies from the terminal. Currently the script is scheduled to send certain messages each week, at a specific time, but I would really like to be able to manually resend the message through the shell.

Something like "python3 ff_bot.py get_trophies" and have the bot send that message again.

Not sure if this is possible, and I am very limited in my programming knowledge. The app was auto deployed to heroku per the readme on GitHub

3
  • 1
    You're probably best off making a stand-alone python file that imports whatever you need. Then just invoke that file at the CLI. Commented Sep 12, 2018 at 17:15
  • yeah I think part my problem is how this is deployed with heroku from that github. Trying to use 'heroku run python3 get_trophies". Commented Sep 12, 2018 at 20:13
  • That's context you should definitely include in the question. Commented Sep 12, 2018 at 20:23

2 Answers 2

1
python -3 <script name> *args **kwargs 

Anything wrong with that?

If it's part of a module

python -3 -m module.script_name *args **kwargs

Alternatively you could do:

from ff_bot import get_trophies

If you put that into your own .py file you will be able to use the function stand alone (providing you don't need to import other things too!)

HTH!

Sign up to request clarification or add additional context in comments.

4 Comments

I'm trying to get this figured out. I think I might be limited by having deployed to heroku and using the 'heroku run python3 ff_bot/ff_bot.py'..... console option. I'm trying to figure out if there is a way to add my own files to the deployed app.
Is it a Discord bot or something?
It is a chat bot for ESPN fantasy football league updates that works with GroupMe, slack, or discord.
Sorry dude, I've never deployed anything on Heroku. If you can upload files, the third suggestion may be appropriate.
0

If you are on Linux you can just use the command line to run the python script as you have described, if you are on Windows, and Python is in your path, you can double-click on the script to run it. Beyond that, you just add the command line argument after the script name: python script.py arg1 arg2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.