Is there any definition when a package imported?

I want to check whether a specify package has imported using #if #end scope, which make my code work correctly both in the project with or without specify package.
How can I do this, is there any definition can tell me a package is imported?

Hello! You can achieve this by creating a define when a package is present on the assembly definition asset of your package.

Here is an example that would add a ADS_PRESENT definition for your C# code when the ads package is present, for this assembly: