this is my code:     # Use ProcessPoolExecutor for parallel processing
    with ProcessPoolExecutor(max_workers=num_processes) as executor:
        results = list(tqdm(executor.map(get_bpr, row_contract_pairs), total=len(row_contract_pairs), desc='Getting BPR'))
 that is located in a def.
 
 the get_bpr is found outside that function.
 
 # find bpr
def get_bpr(index_row_contract):
    index, row, contract = index_row_contract
    # Blank variables for new Search
    placed_order_response = None
    data = {'symbol': None,
            'short_bpr_margin': None,
            'short_bpr_cash': None,
            'long_bpr_margin': None,
            'long_bpr_cash': None,
            'fee_calculation_total_fees': None,
            'price_candidate_used': None,
            'sold_price': None,
            }
    # Set symbol to allow connection
    data['symbol'] = row['symbol']

    # Convert back to Option and FutureOption Classes
    contract = contract_list[index] 

    # Create Legs
    leg = contract.build_leg(Decimal('1'), order.OrderAction.SELL_TO_OPEN)
    buy_leg = contract.build_leg(Decimal('1'), order.OrderAction.BUY_TO_OPEN)
    
    # Try prices in price_candidates until results
    for candidate in row['price_candidates']:
        try:
            # Save Candidates
            data['price_candidate_used'] = candidate
            
            # Rounds to the nearest candidate price
            price_bid = round_mid_price(row['midPrice'], candidate)
            data['sold_price'] = price_bid

            # Sell Side
            order_to_fill = order.NewOrder(
                time_in_force=order.OrderTimeInForce.GTC,
                order_type=order.OrderType.LIMIT,
                price= price_bid,
                legs=[leg],
                price_effect=order.PriceEffect.CREDIT
            )

            # Results of margin account for sell_leg
            placed_order_response_margin = margin_account.place_order(session, order_to_fill, dry_run=True)
            if placed_order_response_margin is not None:
                data['short_bpr_margin'] = placed_order_response_margin.buying_power_effect.change_in_buying_power
                data['fee_calculation_total_fees'] = placed_order_response_margin.fee_calculation.total_fees
                try:
                    # Results of cash account for sell_leg
                    placed_order_response_cash = cash_account.place_order(session, order_to_fill, dry_run=True)
                    data['short_bpr_cash'] = placed_order_response_cash.buying_power_effect.change_in_buying_power
                except Exception as e:
                    # Errors will occur when BPR is not enough in cash account or if trying to short call a ticker less then $10 in value
                    data['short_bpr_cash'] = -float('inf') 
                
                if row['instrument_type']=='FUTURE_OPTION':   
                    # Buy Side    
                    order_to_fill = order.NewOrder(
                    time_in_force=order.OrderTimeInForce.GTC,
                    order_type=order.OrderType.LIMIT,
                    price= price_bid,
                    legs=[buy_leg],
                    price_effect=order.PriceEffect.DEBIT
                    )    

                    # Results of margin account for buy_leg
                    placed_order_response_margin = margin_account.place_order(session, order_to_fill, dry_run=True)
                    if placed_order_response_margin is not None:
                        data['long_bpr_margin'] = placed_order_response_margin.buying_power_effect.change_in_buying_power
                        try:
                            # Results of margin account for buy_leg
                            placed_order_response_cash = cash_account.place_order(session, order_to_fill, dry_run=True)
                            data['long_bpr_cash'] = placed_order_response_cash.buying_power_effect.change_in_buying_power
                        except Exception as e:
                            # Errors will occur when BPR is not enough in cash account or if trying to short call a ticker less then $10 in value
                            data['long_bpr_cash'] = -float('inf')     
                
                else: 
                    data['long_bpr_margin'] = price_bid * row['notional_multiplier']
                    
                    data['long_bpr_cash'] = price_bid * row['notional_multiplier']
                    if data['long_bpr_cash']>= float(cash_balance['derivative_buying_power'].values[0]):
                        data['long_bpr_cash'] = -float('inf')          
                return data
                
        except Exception as e:
            # Log the exception
            logging.error(f"Error processing symbol {row['symbol']}: {str(e)}")
        
            return data
			
			
contract_list was defined in the def where  with ProcessPoolExecutor(max_workers=num_processes) as executor:
        results = list(tqdm(executor.map(get_bpr, row_contract_pairs), total=len(row_contract_pairs), desc='Getting BPR')) is called.


---------------------------------------------------------------------------
_RemoteTraceback                          Traceback (most recent call last)
_RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/process.py", line 246, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/usr/lib/python3.10/concurrent/futures/process.py", line 205, in _process_chunk
    return [fn(*args) for args in chunk]
  File "/usr/lib/python3.10/concurrent/futures/process.py", line 205, in <listcomp>
    return [fn(*args) for args in chunk]
  File "/tmp/ipykernel_3219/4156391043.py", line 93, in get_bpr
    contract = contract_list[index]
NameError: name 'contract_list' is not defined
"""

The above exception was the direct cause of the following exception:

NameError                                 Traceback (most recent call last)
/app/Notebooks/2_oldipynb.ipynb Cell 11 line 1
----> 1 full_df = get_contract_information()

/app/Notebooks/2_oldipynb.ipynb Cell 11 line 5
    501 # Use ProcessPoolExecutor for parallel processing
    502 with ProcessPoolExecutor(max_workers=num_processes) as executor:
...
    404     finally:
    405         # Break a reference cycle with the exception in self._exception
    406         self = None

NameError: name 'contract_list' is not defined