0

So I have two functions in my program right now, with one being an async function and the other being a synchronous function.

Assuming that it looks like this:

async def function1(param):
   ...

def function2(param):
   ...

How do I go about putting both functions in a dispatch table? This is what I have tried which doesn't work:

dispatch_table = {
        "key_1": await function_1
        , "key_2": function_2
    }

dispatch_table[key](param)

Any help will be greatly appreciated, thanks.

ngzs
  • 11
  • 2
  • Does the functions return data, that you want to store in the dictionary? – Cow Aug 30 '22 at 10:18
  • @user56700 No, the functions are supposed to perform their respective API calls. – ngzs Aug 30 '22 at 10:20
  • Does this answer your question? [Test if function or method is normal or asynchronous](https://stackoverflow.com/questions/36076619/test-if-function-or-method-is-normal-or-asynchronous) – mkrieger1 Aug 30 '22 at 10:24

0 Answers0