Implement a royalty in ERC20 for ERC721 trades

When NFT (ERC-721) is traded, I'd like its minter (creator) of the NFT to receive a royalty.

In order to achieve this, I've tried

  1. call ERC20.transferFrom inside of ERC721.transferFrom -> it compiled, but had runtime error.
  2. created a third contract importing both ERC721, ERC20 and then a new function to call ERC20.transferFrom and ERC721.transferFrom -> again, the same runtime error.

How should I go about implementing this? My full code is here ->

Inside contract folder: ERC20Token.sol: my ERC20 contract inheriting openzeppelin erc20 interface NFTTrade.sol: my ERC721 contract inheriting openzeppelin erc721 interface NFTtoken.sol: The third contract to call TransferFrom both ERC20/ERC721 contracts by inheriting both.

:1234: Code to reproduce

:computer: Environment

Truffle v5.4.28 (core: 5.4.28)
Solidity - 0.7.0 (solc-js)
Node v12.14.0
Web3.js v1.5.3

It's not possible to inherit both ERC721 and ERC20 in the same contract.

You have to deploy them separately and probably pass in the address of your ERC20 token as an argument to your ERC721 token.