So it turns out those error messages are more like guidelines than actual rules, and you can turn them off with
from click import core
core._verify_python3_env = lambda: None
(this seems totally hacky and might cause unexpected behavior down the line, but whatever, it's working so far)
So that works, but then I realized that the way I was trying to call my function was totally stupid and was never going to work. Thankfully stackoverflow saved me. Following the instructions at the link, I'm making progress, only now it's telling me I don't have FLASK_APP defined - but wait, I know this one:
import os
os.environ['FLASK_APP'] = 'flaskr'
It works! Final code:
import os
from click import core
from flaskr import db # flaskr is the package containing the code from the tutorial
def call_click_command(cmd, *args, **kwargs):
# see stackoverflow link above for code
# I also put this in a separate file but you do you
os.environ['FLASK_APP'] = 'flaskr'
core._verify_python3_env = lambda: None
call_click_command(db.init_db_command)
(and to run the app, in case anyone needs it):
from flaskr import create_app
app = create_app()
app.run(use_reloader=False, debug=True)